File tree Expand file tree Collapse file tree 2 files changed +31
-4
lines changed Expand file tree Collapse file tree 2 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -148,13 +148,26 @@ describe('Delete phase member', () => {
148148 . expect ( 204 , done ) ;
149149 } ) ;
150150
151- it ( 'should return 403 for copilot' , ( done ) => {
151+ it ( 'should return 204 for copilot which is member of project ' , ( done ) => {
152152 request ( server )
153153 . delete ( `/v5/projects/${ id } /phases/${ phaseId } /members/${ copilotUser . userId } ` )
154154 . set ( {
155155 Authorization : `Bearer ${ testUtil . jwts . copilot } ` ,
156156 } )
157- . expect ( 403 , done ) ;
157+ . expect ( 204 , done ) ;
158+ } ) ;
159+
160+ it ( 'should return 403 for copilot which is not member of project' , ( done ) => {
161+ models . ProjectMember . destroy ( {
162+ where : { userId : testUtil . userIds . copilot , id } ,
163+ } ) . then ( ( ) => {
164+ request ( server )
165+ . delete ( `/v5/projects/${ id } /phases/${ phaseId } /members/${ copilotUser . userId } ` )
166+ . set ( {
167+ Authorization : `Bearer ${ testUtil . jwts . copilot } ` ,
168+ } )
169+ . expect ( 403 , done ) ;
170+ } ) ;
158171 } ) ;
159172 } ) ;
160173} ) ;
Original file line number Diff line number Diff line change @@ -167,14 +167,28 @@ describe('Update phase members', () => {
167167 } ) ;
168168 } ) ;
169169
170- it ( 'should return 403 for copilot' , ( done ) => {
170+ it ( 'should return 200 for copilot which is member of project ' , ( done ) => {
171171 request ( server )
172172 . post ( `/v5/projects/${ id } /phases/${ phaseId } /members` )
173173 . set ( {
174174 Authorization : `Bearer ${ testUtil . jwts . copilot } ` ,
175175 } )
176176 . send ( { userIds : [ copilotUser . userId , memberUser . userId ] } )
177- . expect ( 403 , done ) ;
177+ . expect ( 200 , done ) ;
178+ } ) ;
179+
180+ it ( 'should return 403 for copilot which is not member of project' , ( done ) => {
181+ models . ProjectMember . destroy ( {
182+ where : { userId : testUtil . userIds . copilot , id } ,
183+ } ) . then ( ( ) => {
184+ request ( server )
185+ . post ( `/v5/projects/${ id } /phases/${ phaseId } /members` )
186+ . set ( {
187+ Authorization : `Bearer ${ testUtil . jwts . copilot } ` ,
188+ } )
189+ . send ( { userIds : [ copilotUser . userId , memberUser . userId ] } )
190+ . expect ( 403 , done ) ;
191+ } ) ;
178192 } ) ;
179193 } ) ;
180194} ) ;
You can’t perform that action at this time.
0 commit comments