@@ -1037,12 +1037,14 @@ describe('AbacService (unit)', () => {
10371037 const attributes = [ { key : 'dept' , values : [ 'eng' ] } ] ;
10381038
10391039 it ( 'returns early (no query) when usernames array is empty' , async ( ) => {
1040- await expect ( service . checkUsernamesMatchAttributes ( [ ] , attributes as any , 'objectId' ) ) . resolves . toBeUndefined ( ) ;
1040+ await expect (
1041+ service . checkUsernamesMatchAttributes ( [ ] , attributes as any , { _id : 'xxxxx' , name : 'name' } as any ) ,
1042+ ) . resolves . toBeUndefined ( ) ;
10411043 expect ( mockUsersFind ) . not . toHaveBeenCalled ( ) ;
10421044 } ) ;
10431045
10441046 it ( 'returns early (no query) when attributes array is empty' , async ( ) => {
1045- await expect ( service . checkUsernamesMatchAttributes ( [ 'alice' ] , [ ] , 'objectId' ) ) . resolves . toBeUndefined ( ) ;
1047+ await expect ( service . checkUsernamesMatchAttributes ( [ 'alice' ] , [ ] , { _id : 'xxxxx' , name : 'name' } as any ) ) . resolves . toBeUndefined ( ) ;
10461048 expect ( mockUsersFind ) . not . toHaveBeenCalled ( ) ;
10471049 } ) ;
10481050
@@ -1054,7 +1056,9 @@ describe('AbacService (unit)', () => {
10541056 } ) ,
10551057 } ) ) ;
10561058
1057- await expect ( service . checkUsernamesMatchAttributes ( usernames , attributes as any , 'objectId' ) ) . resolves . toBeUndefined ( ) ;
1059+ await expect (
1060+ service . checkUsernamesMatchAttributes ( usernames , attributes as any , { _id : 'xxxxx' , name : 'name' } as any ) ,
1061+ ) . resolves . toBeUndefined ( ) ;
10581062
10591063 expect ( mockUsersFind ) . toHaveBeenCalledWith (
10601064 {
@@ -1085,7 +1089,9 @@ describe('AbacService (unit)', () => {
10851089 } ) ,
10861090 } ) ) ;
10871091
1088- await expect ( service . checkUsernamesMatchAttributes ( usernames , attributes as any , 'objectId' ) ) . rejects . toMatchObject ( {
1092+ await expect (
1093+ service . checkUsernamesMatchAttributes ( usernames , attributes as any , { _id : 'xxxxx' , name : 'name' } as any ) ,
1094+ ) . rejects . toMatchObject ( {
10891095 code : 'error-only-compliant-users-can-be-added-to-abac-rooms' ,
10901096 } ) ;
10911097 } ) ;
@@ -1099,7 +1105,9 @@ describe('AbacService (unit)', () => {
10991105 } ) ,
11001106 } ) ) ;
11011107
1102- await expect ( service . checkUsernamesMatchAttributes ( usernames , attributes as any , 'objectId' ) ) . resolves . toBeUndefined ( ) ;
1108+ await expect (
1109+ service . checkUsernamesMatchAttributes ( usernames , attributes as any , { _id : 'xxxxx' , name : 'name' } as any ) ,
1110+ ) . resolves . toBeUndefined ( ) ;
11031111
11041112 expect ( mockCreateAuditServerEvent ) . toHaveBeenCalledTimes ( usernames . length ) ;
11051113 const calledUsernames = mockCreateAuditServerEvent . mock . calls . map ( ( [ , payload ] : any [ ] ) => payload ?. subject ?. username ) . filter ( Boolean ) ;
@@ -1116,7 +1124,9 @@ describe('AbacService (unit)', () => {
11161124 } ) ,
11171125 } ) ) ;
11181126
1119- await expect ( service . checkUsernamesMatchAttributes ( usernames , attributes as any , 'objectId' ) ) . rejects . toMatchObject ( {
1127+ await expect (
1128+ service . checkUsernamesMatchAttributes ( usernames , attributes as any , { _id : 'xxxxx' , name : 'name' } as any ) ,
1129+ ) . rejects . toMatchObject ( {
11201130 code : 'error-only-compliant-users-can-be-added-to-abac-rooms' ,
11211131 } ) ;
11221132
0 commit comments