@@ -190,10 +190,10 @@ describe('Test registrations API validators', function () {
190
190
const { total } = await server . users . list ( )
191
191
192
192
await server . config . enableSignup ( false , total + 1 )
193
- await server . registrations . register ( { username : 'user43' , expectedStatus : HttpStatusCode . NO_CONTENT_204 } )
193
+ await server . registrations . register ( { username : 'user43' , expectedStatus : HttpStatusCode . OK_200 } )
194
194
195
195
await server . config . enableSignup ( true , total + 2 )
196
- await server . registrations . requestRegistration ( {
196
+ await server . registrations . register ( {
197
197
username : 'user44' ,
198
198
registrationReason : 'reason' ,
199
199
expectedStatus : HttpStatusCode . OK_200
@@ -214,14 +214,14 @@ describe('Test registrations API validators', function () {
214
214
channel : { name : 'super_user_direct_1_channel' , displayName : 'super user direct 1 channel' }
215
215
}
216
216
217
- await makePostBodyRequest ( { url : server . url , path : registrationPath , fields, expectedStatus : HttpStatusCode . NO_CONTENT_204 } )
217
+ await makePostBodyRequest ( { url : server . url , path : registrationPath , fields, expectedStatus : HttpStatusCode . OK_200 } )
218
218
} )
219
219
220
- it ( 'Should fail if the instance requires approval ' , async function ( ) {
220
+ it ( 'Should fail if registration reason isnt provided ' , async function ( ) {
221
221
this . timeout ( 60000 )
222
222
223
223
await server . config . enableSignup ( true )
224
- await server . registrations . register ( { username : 'user42' , expectedStatus : HttpStatusCode . FORBIDDEN_403 } )
224
+ await server . registrations . register ( { username : 'user42' , expectedStatus : HttpStatusCode . BAD_REQUEST_400 } )
225
225
} )
226
226
} )
227
227
@@ -312,10 +312,15 @@ describe('Test registrations API validators', function () {
312
312
before ( async function ( ) {
313
313
this . timeout ( 60000 )
314
314
315
- await server . config . enableSignup ( true ) ;
315
+ await server . config . enableSignup ( true )
316
+
317
+ await server . registrations . requestRegistration ( { username : 'request_2' , registrationReason : 'toto' } )
318
+ await server . registrations . requestRegistration ( { username : 'request_3' , registrationReason : 'toto' } )
316
319
317
- ( { id : id1 } = await server . registrations . requestRegistration ( { username : 'request_2' , registrationReason : 'toto' } ) ) ;
318
- ( { id : id2 } = await server . registrations . requestRegistration ( { username : 'request_3' , registrationReason : 'toto' } ) )
320
+ const registrations = await server . registrations . list ( )
321
+
322
+ id1 = registrations . data [ 0 ] . id
323
+ id2 = registrations . data [ 1 ] . id
319
324
} )
320
325
321
326
it ( 'Should fail to accept/reject registration without token' , async function ( ) {
@@ -375,9 +380,15 @@ describe('Test registrations API validators', function () {
375
380
let id3 : number
376
381
377
382
before ( async function ( ) {
378
- ( { id : id1 } = await server . registrations . requestRegistration ( { username : 'request_4' , registrationReason : 'toto' } ) ) ;
379
- ( { id : id2 } = await server . registrations . requestRegistration ( { username : 'request_5' , registrationReason : 'toto' } ) ) ;
380
- ( { id : id3 } = await server . registrations . requestRegistration ( { username : 'request_6' , registrationReason : 'toto' } ) )
383
+ await server . registrations . requestRegistration ( { username : 'request_4' , registrationReason : 'toto' } )
384
+ await server . registrations . requestRegistration ( { username : 'request_5' , registrationReason : 'toto' } )
385
+ await server . registrations . requestRegistration ( { username : 'request_6' , registrationReason : 'toto' } )
386
+
387
+ const registrations = await server . registrations . list ( )
388
+
389
+ id1 = registrations . data [ 0 ] . id
390
+ id2 = registrations . data [ 1 ] . id
391
+ id3 = registrations . data [ 2 ] . id
381
392
382
393
await server . registrations . accept ( { id : id2 , moderationResponse : 'tt' } )
383
394
await server . registrations . reject ( { id : id3 , moderationResponse : 'tt' } )
0 commit comments