@@ -66,7 +66,16 @@ describe('POST api/project', () => {
66
66
const params = {
67
67
lang : 'node' ,
68
68
submission : 'https://minio.cb.lk/public/input' ,
69
- lockedFiles : [ 'package.json' , 'yarn.lock' , 'test' ] ,
69
+ config : `
70
+ project:
71
+ allowed-folders:
72
+ - src/**/*.js
73
+ before-test:
74
+ - yarn install
75
+ - yarn build
76
+ testcases:
77
+ - yarn test
78
+ ` ,
70
79
mode : 'sync' ,
71
80
timelimit : 1
72
81
} ;
@@ -85,7 +94,16 @@ describe('POST api/project', () => {
85
94
lang : 'node' ,
86
95
problem : 'not-a-url' ,
87
96
submission : 'https://minio.cb.lk/public/input' ,
88
- lockedFiles : [ 'package.json' , 'yarn.lock' , 'test' ] ,
97
+ config : `
98
+ project:
99
+ allowed-folders:
100
+ - src/**/*.js
101
+ before-test:
102
+ - yarn install
103
+ - yarn build
104
+ testcases:
105
+ - yarn test
106
+ ` ,
89
107
mode : 'sync' ,
90
108
timelimit : 1
91
109
} ;
@@ -103,7 +121,16 @@ describe('POST api/project', () => {
103
121
const params = {
104
122
lang : 'node' ,
105
123
problem : 'https://minio.cb.lk/public/input' ,
106
- lockedFiles : [ 'package.json' , 'yarn.lock' , 'test' ] ,
124
+ config : `
125
+ project:
126
+ allowed-folders:
127
+ - src/**/*.js
128
+ before-test:
129
+ - yarn install
130
+ - yarn build
131
+ testcases:
132
+ - yarn test
133
+ ` ,
107
134
mode : 'sync' ,
108
135
timelimit : 1
109
136
} ;
@@ -122,7 +149,16 @@ describe('POST api/project', () => {
122
149
lang : 'node' ,
123
150
problem : 'https://minio.cb.lk/public/input' ,
124
151
submission : 'not-a-url' ,
125
- lockedFiles : [ 'package.json' , 'yarn.lock' , 'test' ] ,
152
+ config : `
153
+ project:
154
+ allowed-folders:
155
+ - src/**/*.js
156
+ before-test:
157
+ - yarn install
158
+ - yarn build
159
+ testcases:
160
+ - yarn test
161
+ ` ,
126
162
mode : 'sync' ,
127
163
timelimit : 1
128
164
} ;
@@ -136,7 +172,7 @@ describe('POST api/project', () => {
136
172
expect ( res . body . err . message ) . to . equal ( '"submission" must be a valid uri' ) ;
137
173
} ) ;
138
174
139
- it ( 'should throw 400 error for lockedFiles missing' , async ( ) => {
175
+ it ( 'should throw 400 error for config missing' , async ( ) => {
140
176
const params = {
141
177
lang : 'node' ,
142
178
problem : 'https://minio.cb.lk/public/input' ,
@@ -151,15 +187,15 @@ describe('POST api/project', () => {
151
187
} ) . send ( params ) ;
152
188
153
189
expect ( res . status ) . to . equal ( 400 ) ;
154
- expect ( res . body . err . message ) . to . equal ( '"lockedFiles " is required' ) ;
190
+ expect ( res . body . err . message ) . to . equal ( '"config " is required' ) ;
155
191
} ) ;
156
192
157
- it ( 'should throw 400 error when lockedFiles is not a string' , async ( ) => {
193
+ it ( 'should throw 400 error when config is not a string' , async ( ) => {
158
194
const params = {
159
195
lang : 'node' ,
160
196
problem : 'https://minio.cb.lk/public/input' ,
161
197
submission : 'https://minio.cb.lk/public/input' ,
162
- lockedFiles : 123 ,
198
+ config : 123 ,
163
199
mode : 'sync' ,
164
200
timelimit : 1
165
201
} ;
@@ -170,15 +206,24 @@ describe('POST api/project', () => {
170
206
} ) . send ( params ) ;
171
207
172
208
expect ( res . status ) . to . equal ( 400 ) ;
173
- expect ( res . body . err . message ) . to . equal ( '"lockedFiles " must be an array' ) ;
209
+ expect ( res . body . err . message ) . to . equal ( '"config " must be an array' ) ;
174
210
} ) ;
175
211
176
212
it ( 'should throw 400 error for incorrect mode ' , async ( ) => {
177
213
const params = {
178
214
lang : 'node' ,
179
215
problem : 'https://minio.cb.lk/public/input' ,
180
216
submission : 'https://minio.cb.lk/public/input' ,
181
- lockedFiles : [ 'package.json' , 'yarn.lock' , 'test' ] ,
217
+ config : `
218
+ project:
219
+ allowed-folders:
220
+ - src/**/*.js
221
+ before-test:
222
+ - yarn install
223
+ - yarn build
224
+ testcases:
225
+ - yarn test
226
+ ` ,
182
227
mode : 'abc' ,
183
228
timelimit : 1
184
229
} ;
@@ -197,7 +242,16 @@ describe('POST api/project', () => {
197
242
lang : 'node' ,
198
243
problem : 'https://minio.cb.lk/public/input' ,
199
244
submission : 'https://minio.cb.lk/public/input' ,
200
- lockedFiles : [ 'package.json' , 'yarn.lock' , 'test' ] ,
245
+ config : `
246
+ project:
247
+ allowed-folders:
248
+ - src/**/*.js
249
+ before-test:
250
+ - yarn install
251
+ - yarn build
252
+ testcases:
253
+ - yarn test
254
+ ` ,
201
255
mode : 'callback' ,
202
256
timelimit : 1
203
257
} ;
@@ -216,7 +270,16 @@ describe('POST api/project', () => {
216
270
lang : 'node' ,
217
271
problem : 'https://minio.cb.lk/public/input' ,
218
272
submission : 'https://minio.cb.lk/public/input' ,
219
- lockedFiles : [ 'package.json' , 'yarn.lock' , 'test' ] ,
273
+ config : `
274
+ project:
275
+ allowed-folders:
276
+ - src/**/*.js
277
+ before-test:
278
+ - yarn install
279
+ - yarn build
280
+ testcases:
281
+ - yarn test
282
+ ` ,
220
283
mode : 'sync' ,
221
284
timelimit : 1
222
285
} ;
@@ -236,7 +299,16 @@ describe('POST api/project', () => {
236
299
lang : 'node' ,
237
300
problem : 'https://minio.cb.lk/public/input' ,
238
301
submission : 'https://minio.cb.lk/public/input' ,
239
- lockedFiles : [ 'package.json' , 'yarn.lock' , 'test' ] ,
302
+ config : `
303
+ project:
304
+ allowed-folders:
305
+ - src/**/*.js
306
+ before-test:
307
+ - yarn install
308
+ - yarn build
309
+ testcases:
310
+ - yarn test
311
+ ` ,
240
312
mode : 'poll' ,
241
313
timelimit : 1
242
314
} ;
@@ -261,7 +333,16 @@ describe('POST api/project', () => {
261
333
lang : 'node' ,
262
334
problem : 'https://minio.cb.lk/public/input' ,
263
335
submission : 'https://minio.cb.lk/public/input' ,
264
- lockedFiles : [ 'package.json' , 'yarn.lock' , 'test' ] ,
336
+ config : `
337
+ project:
338
+ allowed-folders:
339
+ - src/**/*.js
340
+ before-test:
341
+ - yarn install
342
+ - yarn build
343
+ testcases:
344
+ - yarn test
345
+ ` ,
265
346
mode : 'callback' ,
266
347
callback : 'http://localhost:2404' ,
267
348
timelimit : 1
0 commit comments