@@ -74,18 +74,16 @@ describe('CREATE Project Setting', () => {
74
74
let estimationId ;
75
75
76
76
const body = {
77
- param : {
78
- key : 'markup_topcoder_service' ,
79
- value : '3500' ,
80
- valueType : 'double' ,
81
- readPermission : {
82
- projectRoles : [ 'customer' ] ,
83
- topcoderRoles : [ 'administrator' ] ,
84
- } ,
85
- writePermission : {
86
- allowRule : { topcoderRoles : [ 'administrator' ] } ,
87
- denyRule : { projectRoles : [ 'copilot' ] } ,
88
- } ,
77
+ key : 'markup_topcoder_service' ,
78
+ value : '3500' ,
79
+ valueType : 'double' ,
80
+ readPermission : {
81
+ projectRoles : [ 'customer' ] ,
82
+ topcoderRoles : [ 'administrator' ] ,
83
+ } ,
84
+ writePermission : {
85
+ allowRule : { topcoderRoles : [ 'administrator' ] } ,
86
+ denyRule : { projectRoles : [ 'copilot' ] } ,
89
87
} ,
90
88
} ;
91
89
@@ -175,7 +173,7 @@ describe('CREATE Project Setting', () => {
175
173
176
174
it ( 'should return 400 for missing key' , ( done ) => {
177
175
const invalidBody = _ . cloneDeep ( body ) ;
178
- delete invalidBody . param . key ;
176
+ delete invalidBody . key ;
179
177
180
178
request ( server )
181
179
. post ( `/v5/projects/${ projectId } /settings` )
@@ -189,7 +187,7 @@ describe('CREATE Project Setting', () => {
189
187
190
188
it ( 'should return 400 for missing value' , ( done ) => {
191
189
const invalidBody = _ . cloneDeep ( body ) ;
192
- delete invalidBody . param . value ;
190
+ delete invalidBody . value ;
193
191
194
192
request ( server )
195
193
. post ( `/v5/projects/${ projectId } /settings` )
@@ -203,7 +201,7 @@ describe('CREATE Project Setting', () => {
203
201
204
202
it ( 'should return 400 for missing valueType' , ( done ) => {
205
203
const invalidBody = _ . cloneDeep ( body ) ;
206
- delete invalidBody . param . valueType ;
204
+ delete invalidBody . valueType ;
207
205
208
206
request ( server )
209
207
. post ( `/v5/projects/${ projectId } /settings` )
@@ -217,8 +215,8 @@ describe('CREATE Project Setting', () => {
217
215
218
216
xit ( 'should return 400 for negative value when valueType = percentage' , ( done ) => {
219
217
const invalidBody = _ . cloneDeep ( body ) ;
220
- invalidBody . param . value = '-10' ;
221
- invalidBody . param . valueType = VALUE_TYPE . PERCENTAGE ;
218
+ invalidBody . value = '-10' ;
219
+ invalidBody . valueType = VALUE_TYPE . PERCENTAGE ;
222
220
223
221
request ( server )
224
222
. post ( `/v5/projects/${ projectId } /settings` )
@@ -232,8 +230,8 @@ describe('CREATE Project Setting', () => {
232
230
233
231
xit ( 'should return 400 for value greater than 100 when valueType = percentage' , ( done ) => {
234
232
const invalidBody = _ . cloneDeep ( body ) ;
235
- invalidBody . param . value = '150' ;
236
- invalidBody . param . valueType = VALUE_TYPE . PERCENTAGE ;
233
+ invalidBody . value = '150' ;
234
+ invalidBody . valueType = VALUE_TYPE . PERCENTAGE ;
237
235
238
236
request ( server )
239
237
. post ( `/v5/projects/${ projectId } /settings` )
@@ -247,11 +245,11 @@ describe('CREATE Project Setting', () => {
247
245
248
246
it ( 'should return 400, for admin, when create key with existing key' , ( done ) => {
249
247
const existing = _ . cloneDeep ( body ) ;
250
- existing . param . projectId = projectId ;
251
- existing . param . createdBy = 1 ;
252
- existing . param . updatedBy = 1 ;
248
+ existing . projectId = projectId ;
249
+ existing . createdBy = 1 ;
250
+ existing . updatedBy = 1 ;
253
251
254
- models . ProjectSetting . create ( existing . param ) . then ( ( ) => {
252
+ models . ProjectSetting . create ( existing ) . then ( ( ) => {
255
253
request ( server )
256
254
. post ( `/v5/projects/${ projectId } /settings` )
257
255
. set ( {
@@ -265,7 +263,7 @@ describe('CREATE Project Setting', () => {
265
263
it ( 'should return 201 for manager with non-estimation type, not calculating project estimation items' ,
266
264
( done ) => {
267
265
const createBody = _ . cloneDeep ( body ) ;
268
- createBody . param . key = 'markup_no_estimation' ;
266
+ createBody . key = 'markup_no_estimation' ;
269
267
270
268
request ( server )
271
269
. post ( `/v5/projects/${ projectId } /settings` )
@@ -278,10 +276,10 @@ describe('CREATE Project Setting', () => {
278
276
. end ( ( err , res ) => {
279
277
if ( err ) done ( err ) ;
280
278
281
- const resJson = res . body . result . content ;
282
- resJson . key . should . be . eql ( createBody . param . key ) ;
283
- resJson . value . should . be . eql ( createBody . param . value ) ;
284
- resJson . valueType . should . be . eql ( createBody . param . valueType ) ;
279
+ const resJson = res . body ;
280
+ resJson . key . should . be . eql ( createBody . key ) ;
281
+ resJson . value . should . be . eql ( createBody . value ) ;
282
+ resJson . valueType . should . be . eql ( createBody . valueType ) ;
285
283
resJson . projectId . should . be . eql ( projectId ) ;
286
284
resJson . createdBy . should . be . eql ( 40051334 ) ;
287
285
should . exist ( resJson . createdAt ) ;
@@ -305,10 +303,10 @@ describe('CREATE Project Setting', () => {
305
303
. end ( ( err , res ) => {
306
304
if ( err ) done ( err ) ;
307
305
308
- const resJson = res . body . result . content ;
309
- resJson . key . should . be . eql ( body . param . key ) ;
310
- resJson . value . should . be . eql ( body . param . value ) ;
311
- resJson . valueType . should . be . eql ( body . param . valueType ) ;
306
+ const resJson = res . body ;
307
+ resJson . key . should . be . eql ( body . key ) ;
308
+ resJson . value . should . be . eql ( body . value ) ;
309
+ resJson . valueType . should . be . eql ( body . valueType ) ;
312
310
resJson . projectId . should . be . eql ( projectId ) ;
313
311
resJson . createdBy . should . be . eql ( 40051334 ) ;
314
312
should . exist ( resJson . createdAt ) ;
@@ -318,9 +316,9 @@ describe('CREATE Project Setting', () => {
318
316
should . not . exist ( resJson . deletedAt ) ;
319
317
expectAfterCreate ( resJson . id , projectId , _ . assign ( estimation , {
320
318
id : estimationId ,
321
- value : body . param . value ,
322
- valueType : body . param . valueType ,
323
- key : body . param . key ,
319
+ value : body . value ,
320
+ valueType : body . valueType ,
321
+ key : body . key ,
324
322
} ) , 1 , 0 , err , done ) ;
325
323
} ) ;
326
324
} ) ;
@@ -337,10 +335,10 @@ describe('CREATE Project Setting', () => {
337
335
. end ( ( err , res ) => {
338
336
if ( err ) done ( err ) ;
339
337
340
- const resJson = res . body . result . content ;
341
- resJson . key . should . be . eql ( body . param . key ) ;
342
- resJson . value . should . be . eql ( body . param . value ) ;
343
- resJson . valueType . should . be . eql ( body . param . valueType ) ;
338
+ const resJson = res . body ;
339
+ resJson . key . should . be . eql ( body . key ) ;
340
+ resJson . value . should . be . eql ( body . value ) ;
341
+ resJson . valueType . should . be . eql ( body . valueType ) ;
344
342
resJson . projectId . should . be . eql ( projectId ) ;
345
343
resJson . createdBy . should . be . eql ( 40051333 ) ;
346
344
should . exist ( resJson . createdAt ) ;
@@ -364,10 +362,10 @@ describe('CREATE Project Setting', () => {
364
362
. end ( ( err , res ) => {
365
363
if ( err ) done ( err ) ;
366
364
367
- const resJson = res . body . result . content ;
368
- resJson . key . should . be . eql ( body . param . key ) ;
369
- resJson . value . should . be . eql ( body . param . value ) ;
370
- resJson . valueType . should . be . eql ( body . param . valueType ) ;
365
+ const resJson = res . body ;
366
+ resJson . key . should . be . eql ( body . key ) ;
367
+ resJson . value . should . be . eql ( body . value ) ;
368
+ resJson . valueType . should . be . eql ( body . valueType ) ;
371
369
resJson . projectId . should . be . eql ( projectId ) ;
372
370
resJson . createdBy . should . be . eql ( 40051336 ) ;
373
371
resJson . updatedBy . should . be . eql ( 40051336 ) ;
0 commit comments