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', () => {
148
148
. expect ( 204 , done ) ;
149
149
} ) ;
150
150
151
- it ( 'should return 403 for copilot' , ( done ) => {
151
+ it ( 'should return 204 for copilot which is member of project ' , ( done ) => {
152
152
request ( server )
153
153
. delete ( `/v5/projects/${ id } /phases/${ phaseId } /members/${ copilotUser . userId } ` )
154
154
. set ( {
155
155
Authorization : `Bearer ${ testUtil . jwts . copilot } ` ,
156
156
} )
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
+ } ) ;
158
171
} ) ;
159
172
} ) ;
160
173
} ) ;
Original file line number Diff line number Diff line change @@ -167,14 +167,28 @@ describe('Update phase members', () => {
167
167
} ) ;
168
168
} ) ;
169
169
170
- it ( 'should return 403 for copilot' , ( done ) => {
170
+ it ( 'should return 200 for copilot which is member of project ' , ( done ) => {
171
171
request ( server )
172
172
. post ( `/v5/projects/${ id } /phases/${ phaseId } /members` )
173
173
. set ( {
174
174
Authorization : `Bearer ${ testUtil . jwts . copilot } ` ,
175
175
} )
176
176
. 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
+ } ) ;
178
192
} ) ;
179
193
} ) ;
180
194
} ) ;
You can’t perform that action at this time.
0 commit comments