@@ -125,7 +125,7 @@ describe('withInFlightGenerationForDesign', () => {
125125 const controller = new AbortController ( ) ;
126126 const otherController = new AbortController ( ) ;
127127 const inFlight = new Map < string , AbortController > ( ) ;
128- const inFlightByDesign = new Map < string , string > ( ) ;
128+ const inFlightByDesign = new Map < string , { generationId : string ; startedAt : number } > ( ) ;
129129 let releaseFirst ! : ( ) => void ;
130130 const firstDone = new Promise < void > ( ( resolve ) => {
131131 releaseFirst = resolve ;
@@ -143,7 +143,7 @@ describe('withInFlightGenerationForDesign', () => {
143143 } ,
144144 ) ;
145145
146- await vi . waitFor ( ( ) => expect ( inFlightByDesign . get ( 'design-1' ) ) . toBe ( 'gen-1' ) ) ;
146+ await vi . waitFor ( ( ) => expect ( inFlightByDesign . get ( 'design-1' ) ?. generationId ) . toBe ( 'gen-1' ) ) ;
147147 await expect (
148148 withInFlightGenerationForDesign (
149149 'gen-2' ,
@@ -167,7 +167,7 @@ describe('withInFlightGenerationForDesign', () => {
167167
168168 it ( 'allows different designs to run concurrently' , async ( ) => {
169169 const inFlight = new Map < string , AbortController > ( ) ;
170- const inFlightByDesign = new Map < string , string > ( ) ;
170+ const inFlightByDesign = new Map < string , { generationId : string ; startedAt : number } > ( ) ;
171171 const firstController = new AbortController ( ) ;
172172 const secondController = new AbortController ( ) ;
173173
@@ -196,7 +196,7 @@ describe('withInFlightGenerationForDesign', () => {
196196 it ( 'clears the design lock when cancellation removes the generation' , async ( ) => {
197197 const controller = makeController ( ) ;
198198 const inFlight = new Map ( [ [ 'gen-1' , controller ] ] ) ;
199- const inFlightByDesign = new Map ( [ [ 'design-1' , 'gen-1' ] ] ) ;
199+ const inFlightByDesign = new Map ( [ [ 'design-1' , { generationId : 'gen-1' , startedAt : 1234 } ] ] ) ;
200200 const logIpc = { info : vi . fn ( ) } ;
201201
202202 cancelGenerationRequest ( 'gen-1' , inFlight , logIpc , inFlightByDesign ) ;
@@ -207,15 +207,15 @@ describe('withInFlightGenerationForDesign', () => {
207207} ) ;
208208
209209describe ( 'listInFlightGenerations' , ( ) => {
210- it ( 'returns design/generation pairs from the main-process in-flight registry' , ( ) => {
210+ it ( 'returns design/generation start times from the main-process in-flight registry' , ( ) => {
211211 const inFlightByDesign = new Map ( [
212- [ 'design-b' , 'gen-b' ] ,
213- [ 'design-a' , 'gen-a' ] ,
212+ [ 'design-b' , { generationId : 'gen-b' , startedAt : 2000 } ] ,
213+ [ 'design-a' , { generationId : 'gen-a' , startedAt : 1000 } ] ,
214214 ] ) ;
215215
216216 expect ( listInFlightGenerations ( inFlightByDesign ) ) . toEqual ( [
217- { designId : 'design-a' , generationId : 'gen-a' } ,
218- { designId : 'design-b' , generationId : 'gen-b' } ,
217+ { designId : 'design-a' , generationId : 'gen-a' , startedAt : 1000 } ,
218+ { designId : 'design-b' , generationId : 'gen-b' , startedAt : 2000 } ,
219219 ] ) ;
220220 } ) ;
221221} ) ;
0 commit comments