File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -589,26 +589,35 @@ describe('Database clients', async () => {
589589 } ) ;
590590
591591 it ( 'should be able to check if a user can approve/reject push' , async function ( ) {
592- let threwError = false ;
592+ let allowed = undefined ;
593593 const repoName = trimTrailingDotGit ( TEST_PUSH . repoName ) ;
594+
594595 try {
595596 // push does not exist yet, should return false
596- let allowed = await db . canUserApproveRejectPush ( TEST_PUSH . id , TEST_USER . username ) ;
597+ allowed = await db . canUserApproveRejectPush ( TEST_PUSH . id , TEST_USER . username ) ;
597598 expect ( allowed ) . to . be . false ;
599+ } catch ( e ) {
600+ expect . fail ( e ) ;
601+ }
598602
603+ try {
599604 // create the push - user should already exist and not authorised to push
600605 await db . writeAudit ( TEST_PUSH ) ;
601606 allowed = await db . canUserApproveRejectPush ( TEST_PUSH . id , TEST_USER . username ) ;
602607 expect ( allowed ) . to . be . false ;
608+ } catch ( e ) {
609+ expect . fail ( e ) ;
610+ }
603611
612+ try {
604613 // authorise user and recheck
605614 await db . addUserCanAuthorise ( repoName , TEST_USER . username ) ;
606615 allowed = await db . canUserApproveRejectPush ( TEST_PUSH . id , TEST_USER . username ) ;
607616 expect ( allowed ) . to . be . true ;
608617 } catch ( e ) {
609- threwError = true ;
618+ expect . fail ( e ) ;
610619 }
611- expect ( threwError ) . to . be . false ;
620+
612621 // clean up
613622 await db . deletePush ( TEST_PUSH . id ) ;
614623 await db . removeUserCanAuthorise ( repoName , TEST_USER . username ) ;
You can’t perform that action at this time.
0 commit comments