@@ -66,6 +66,7 @@ describe('Project', () => {
6666 details : { } ,
6767 createdBy : 1 ,
6868 updatedBy : 1 ,
69+ templateId : 1 ,
6970 lastActivityAt : 1 ,
7071 lastActivityUserId : '1' ,
7172 createdAt : '2016-06-30 00:33:07+00' ,
@@ -79,6 +80,7 @@ describe('Project', () => {
7980 details : { } ,
8081 createdBy : 1 ,
8182 updatedBy : 1 ,
83+ templateId : 1 ,
8284 lastActivityAt : 1 ,
8385 lastActivityUserId : '1' ,
8486 createdAt : '2016-06-30 00:33:07+00' ,
@@ -91,6 +93,7 @@ describe('Project', () => {
9193 details : { } ,
9294 createdBy : 1 ,
9395 updatedBy : 1 ,
96+ templateId : 1 ,
9497 lastActivityAt : 1 ,
9598 lastActivityUserId : '1' ,
9699 createdAt : '2016-06-30 00:33:07+00' ,
@@ -119,6 +122,12 @@ describe('Project', () => {
119122 userId : 40051332 ,
120123 createdBy : 1 ,
121124 updatedBy : 1 ,
125+ } , {
126+ projectId : project1 . id ,
127+ role : 'member' ,
128+ userId : 40051331 ,
129+ createdBy : 1 ,
130+ updatedBy : 1 ,
122131 } ] ) ;
123132 } ) . then ( ( ) => done ( ) ) ;
124133 } ) ;
@@ -179,6 +188,84 @@ describe('Project', () => {
179188 } ) ;
180189 } ) ;
181190
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+
182269 it ( 'should return 200 if topcoder manager user will update a project' , ( done ) => {
183270 request ( server )
184271 . patch ( `/v4/projects/${ project1 . id } ` )
0 commit comments