@@ -13,8 +13,10 @@ const chai = require('chai');
13
13
14
14
const projectService = require ( '../../../modules/project.service' ) ;
15
15
const reqService = require ( '../../../modules/request.service' ) ;
16
- const { testTimeout, ADMIN_COOKIE } = require ( '../../../config' ) ;
16
+ const { testTimeout, ADMIN_COOKIE , pathToApiSpec } = require ( '../../../config' ) ;
17
+ const chaiResValidator = require ( 'chai-openapi-response-validator' ) ;
17
18
19
+ chai . use ( chaiResValidator ( pathToApiSpec ) ) ;
18
20
chai . should ( ) ;
19
21
20
22
describe ( 'Load Runner Tests' , function ( ) {
@@ -42,7 +44,7 @@ describe('Load Runner Tests', function() {
42
44
43
45
// workspace_location = await projectService.findWorkspaceLocation();
44
46
// const projectPath = path.join(workspace_location, projectName);
45
- //await fs.remove(projectPath);
47
+ // await fs.remove(projectPath);
46
48
} ) ;
47
49
48
50
describe ( 'POST loadtest/config' , function ( ) {
@@ -51,14 +53,14 @@ describe('Load Runner Tests', function() {
51
53
it ( 'returns status 200 to POST/loadtest/config to the load-test/config.json' , async function ( ) {
52
54
this . timeout ( testTimeout . short ) ;
53
55
const res = await writeToLoadTestConfig ( projectID , configOptions ) ;
54
- res . should . have . status ( 200 ) ;
56
+ res . should . have . status ( 200 ) . and . satisfyApiSpec ;
55
57
} ) ;
56
58
57
59
it ( 'returns status 200 to POST/loadtest/config when query parameters are included' , async function ( ) {
58
60
this . timeout ( testTimeout . short ) ;
59
61
configOptions . query = { a : '1' , b : '2' } ;
60
62
const res = await writeToLoadTestConfig ( projectID , configOptions ) ;
61
- res . should . have . status ( 200 ) ;
63
+ res . should . have . status ( 200 ) . and . satisfyApiSpec ;
62
64
} ) ;
63
65
64
66
it ( 'returns status 200 to GET/loadtest/config with the correct decoded options' , async function ( ) {
@@ -67,7 +69,7 @@ describe('Load Runner Tests', function() {
67
69
delete configOptions . query ;
68
70
expectedSavedConfig = modifyOptions ( configOptions , { path : '/?a=1&b=2' } ) ;
69
71
const res = await readLoadTestConfig ( projectID ) ;
70
- res . should . have . status ( 200 ) ;
72
+ res . should . have . status ( 200 ) . and . satisfyApiSpec ;
71
73
res . body . should . deep . equal ( expectedSavedConfig ) ;
72
74
} ) ;
73
75
} ) ;
@@ -77,13 +79,13 @@ describe('Load Runner Tests', function() {
77
79
configOptions . query = { a : '1' , b : '2' } ;
78
80
configOptions . config = 'Not a valid option' ;
79
81
const res = await writeToLoadTestConfig ( projectID , configOptions ) ;
80
- res . should . have . status ( 200 ) ;
82
+ res . should . have . status ( 200 ) . and . satisfyApiSpec ;
81
83
} ) ;
82
84
83
85
it ( 'returns status 200 to GET/loadtest/config and not return these non-config fields in loadtest/config.json' , async function ( ) {
84
86
this . timeout ( testTimeout . short ) ;
85
87
const res = await readLoadTestConfig ( projectID ) ;
86
- res . should . have . status ( 200 ) ;
88
+ res . should . have . status ( 200 ) . and . satisfyApiSpec ;
87
89
res . body . should . deep . equal ( expectedSavedConfig ) ;
88
90
} ) ;
89
91
} ) ;
@@ -92,14 +94,14 @@ describe('Load Runner Tests', function() {
92
94
this . timeout ( testTimeout . short ) ;
93
95
configOptions . query = { } ;
94
96
const res = await writeToLoadTestConfig ( projectID , configOptions ) ;
95
- res . should . have . status ( 200 ) ;
97
+ res . should . have . status ( 200 ) . and . satisfyApiSpec ;
96
98
} ) ;
97
99
98
100
it ( 'returns status 200 to GET/loadtest/config and not return these non-config fields in loadtest/config.json' , async function ( ) {
99
101
this . timeout ( testTimeout . short ) ;
100
102
expectedSavedConfig . path = '/' ;
101
103
const res = await readLoadTestConfig ( projectID ) ;
102
- res . should . have . status ( 200 ) ;
104
+ res . should . have . status ( 200 ) . and . satisfyApiSpec ;
103
105
res . body . should . deep . equal ( expectedSavedConfig ) ;
104
106
} ) ;
105
107
} ) ;
@@ -142,7 +144,7 @@ describe('Load Runner Tests', function() {
142
144
it ( 'returns status 200 to GET/loadtest/config from the load-test/config.json' , async function ( ) {
143
145
this . timeout ( testTimeout . short ) ;
144
146
const res = await readLoadTestConfig ( projectID ) ;
145
- res . should . have . status ( 200 ) ;
147
+ res . should . have . status ( 200 ) . and . satisfyApiSpec ;
146
148
res . body . should . deep . equal ( expectedSavedConfig ) ;
147
149
} ) ;
148
150
} ) ;
0 commit comments