File tree Expand file tree Collapse file tree
worker/src/temporal/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,13 +252,17 @@ describe('executeWorkflow', () => {
252252 const branchStartDelta = Math . abs ( branchA . startedAt - branchB . startedAt ) ;
253253 expect ( branchStartDelta ) . toBeLessThan ( 75 ) ;
254254
255- const branchAElapsed = branchA . endedAt - branchA . startedAt ;
256- const branchBElapsed = branchB . endedAt - branchB . startedAt ;
257- expect ( branchAElapsed ) . toBeGreaterThanOrEqual ( 190 ) ;
258- expect ( branchBElapsed ) . toBeGreaterThanOrEqual ( 190 ) ;
255+ const branchesOverlap =
256+ Math . max ( branchA . startedAt , branchB . startedAt ) < Math . min ( branchA . endedAt , branchB . endedAt ) ;
257+ expect ( branchesOverlap ) . toBe ( true ) ;
258+
259+ expect ( merge . startedAt ) . toBeGreaterThanOrEqual ( Math . max ( branchA . endedAt , branchB . endedAt ) - 5 ) ;
259260
260261 const totalElapsed = merge . endedAt - start . startedAt ;
261- expect ( totalElapsed ) . toBeLessThan ( 350 ) ;
262+ // A serial execution would take roughly 450ms before merge overhead
263+ // (50ms start + 200ms branchA + 200ms branchB). Keep the assertion about
264+ // scheduler behavior, not timer precision.
265+ expect ( totalElapsed ) . toBeLessThan ( 450 ) ;
262266 } ) ;
263267
264268 it ( 'produces a deterministic trace sequence across repeated runs' , async ( ) => {
You can’t perform that action at this time.
0 commit comments