@@ -104,7 +104,7 @@ it('resumes relationship pages from stored continuations, refuses incomplete Gra
104104 . update ( peopleDirectorySync )
105105 . set ( { source : 'entra' } )
106106 . where ( eq ( peopleDirectorySync . organizationId , run . organizationId ) )
107- await writeUsers ( null , [ person ( 'lead' ) , person ( 'worker' ) , person ( 'other' ) ] )
107+ await writeUsers ( null , [ person ( 'lead' ) , person ( 'worker' ) , person ( 'other' ) , person ( 'peer' ) ] )
108108 await expect ( db . transaction ( ( tx ) => publishStagedSnapshot ( tx , run , 'entra' ) ) ) . rejects . toThrow (
109109 / r e l a t i o n s h i p | r e p o r t / i
110110 )
@@ -124,12 +124,17 @@ it('resumes relationship pages from stored continuations, refuses incomplete Gra
124124 } )
125125 await record ( 'lead' , 'continuation' , [ 'worker' ] , null )
126126 await record ( 'other' , null , [ 'worker' ] , null )
127- await record ( 'worker' , null , [ ] , null )
127+ await db . transaction ( ( tx ) =>
128+ stageRelationships ( tx , run , [
129+ { managerId : 'worker' , cursor : null , reportIds : [ 'other' ] , nextCursor : null } ,
130+ { managerId : 'peer' , cursor : null , reportIds : [ 'other' ] , nextCursor : null } ,
131+ ] )
132+ )
128133 expect ( await pendingManagers ( db , run ) ) . toEqual ( [ ] )
129134 await db . transaction ( ( tx ) => publishStagedSnapshot ( tx , run , 'entra' ) )
130- expect ( ( await published ( ) ) . find ( ( r ) => r . externalId === 'worker' ) ? .managerExternalId ) . toBe (
131- ' other'
132- )
135+ const managers = new Map ( ( await published ( ) ) . map ( ( r ) => [ r . externalId , r . managerExternalId ] ) )
136+ expect ( managers . get ( 'worker' ) ) . toBe ( ' other')
137+ expect ( managers . get ( 'other' ) ) . toBe ( 'peer' )
133138} )
134139it ( 'refuses to publish a replaced generation' , async ( ) => {
135140 await writeUsers ( null , [ person ( 'live' ) ] )
0 commit comments