@@ -66,6 +66,7 @@ describe('Project', () => {
66
66
details : { } ,
67
67
createdBy : 1 ,
68
68
updatedBy : 1 ,
69
+ templateId : 1 ,
69
70
lastActivityAt : 1 ,
70
71
lastActivityUserId : '1' ,
71
72
createdAt : '2016-06-30 00:33:07+00' ,
@@ -79,6 +80,7 @@ describe('Project', () => {
79
80
details : { } ,
80
81
createdBy : 1 ,
81
82
updatedBy : 1 ,
83
+ templateId : 1 ,
82
84
lastActivityAt : 1 ,
83
85
lastActivityUserId : '1' ,
84
86
createdAt : '2016-06-30 00:33:07+00' ,
@@ -91,6 +93,7 @@ describe('Project', () => {
91
93
details : { } ,
92
94
createdBy : 1 ,
93
95
updatedBy : 1 ,
96
+ templateId : 1 ,
94
97
lastActivityAt : 1 ,
95
98
lastActivityUserId : '1' ,
96
99
createdAt : '2016-06-30 00:33:07+00' ,
@@ -119,6 +122,12 @@ describe('Project', () => {
119
122
userId : 40051332 ,
120
123
createdBy : 1 ,
121
124
updatedBy : 1 ,
125
+ } , {
126
+ projectId : project1 . id ,
127
+ role : 'member' ,
128
+ userId : 40051331 ,
129
+ createdBy : 1 ,
130
+ updatedBy : 1 ,
122
131
} ] ) ;
123
132
} ) . then ( ( ) => done ( ) ) ;
124
133
} ) ;
@@ -179,6 +188,84 @@ describe('Project', () => {
179
188
} ) ;
180
189
} ) ;
181
190
191
+ it ( 'should not update the templateId for admin' , ( done ) => {
192
+ request ( server )
193
+ . patch ( `/v4/projects/${ project1 . id } ` )
194
+ . set ( {
195
+ Authorization : `Bearer ${ testUtil . jwts . admin } ` ,
196
+ } )
197
+ . send ( {
198
+ param : {
199
+ templateId : 2 ,
200
+ } ,
201
+ } )
202
+ . expect ( 'Content-Type' , / j s o n / )
203
+ . expect ( 200 )
204
+ . end ( ( err , res ) => {
205
+ if ( err ) {
206
+ done ( err ) ;
207
+ } else {
208
+ const result = res . body . result ;
209
+ result . success . should . be . true ;
210
+ result . status . should . equal ( 200 ) ;
211
+ result . content . templateId . should . equal ( project1 . templateId ) ;
212
+ done ( ) ;
213
+ }
214
+ } ) ;
215
+ } ) ;
216
+
217
+ it ( 'should not update the templateId for manager' , ( done ) => {
218
+ request ( server )
219
+ . patch ( `/v4/projects/${ project1 . id } ` )
220
+ . set ( {
221
+ Authorization : `Bearer ${ testUtil . jwts . manager } ` ,
222
+ } )
223
+ . send ( {
224
+ param : {
225
+ templateId : 2 ,
226
+ } ,
227
+ } )
228
+ . expect ( 'Content-Type' , / j s o n / )
229
+ . expect ( 200 )
230
+ . end ( ( err , res ) => {
231
+ if ( err ) {
232
+ done ( err ) ;
233
+ } else {
234
+ const result = res . body . result ;
235
+ result . success . should . be . true ;
236
+ result . status . should . equal ( 200 ) ;
237
+ result . content . templateId . should . equal ( project1 . templateId ) ;
238
+ done ( ) ;
239
+ }
240
+ } ) ;
241
+ } ) ;
242
+
243
+ it ( 'should not update the templateId for user' , ( done ) => {
244
+ request ( server )
245
+ . patch ( `/v4/projects/${ project1 . id } ` )
246
+ . set ( {
247
+ Authorization : `Bearer ${ testUtil . jwts . member } ` ,
248
+ } )
249
+ . send ( {
250
+ param : {
251
+ templateId : 2 ,
252
+ } ,
253
+ } )
254
+ . expect ( 'Content-Type' , / j s o n / )
255
+ . expect ( 200 )
256
+ . end ( ( err , res ) => {
257
+ if ( err ) {
258
+ done ( err ) ;
259
+ } else {
260
+ const result = res . body . result ;
261
+ result . success . should . be . true ;
262
+ result . status . should . equal ( 200 ) ;
263
+ result . content . templateId . should . equal ( project1 . templateId ) ;
264
+ done ( ) ;
265
+ }
266
+ } ) ;
267
+ } ) ;
268
+
182
269
it ( 'should return 200 if topcoder manager user will update a project' , ( done ) => {
183
270
request ( server )
184
271
. patch ( `/v4/projects/${ project1 . id } ` )
0 commit comments