@@ -910,6 +910,17 @@ describe('executeWorkflowCore terminal finalization sequencing', () => {
910910 expect ( loadWorkflowDeploymentVersionStateMock ) . not . toHaveBeenCalled ( )
911911 } )
912912
913+ function createDraftResumeSnapshot ( workflow : unknown ) {
914+ const base = createSnapshot ( )
915+ return new ExecutionSnapshot (
916+ { ...base . metadata , resumeFromSnapshot : true , resumeTerminalNoop : true } ,
917+ workflow ,
918+ { } ,
919+ { } ,
920+ [ ]
921+ )
922+ }
923+
913924 it ( 'runs a draft resume on the graph it paused on, never the live draft' , async ( ) => {
914925 const pausedWorkflow = {
915926 version : '1.0' ,
@@ -925,18 +936,11 @@ describe('executeWorkflowCore terminal finalization sequencing', () => {
925936 logs : [ ] ,
926937 metadata : { duration : 1 , startTime : 'start' , endTime : 'end' } ,
927938 } )
928- const resumedSnapshot = createSnapshot ( )
929- resumedSnapshot . metadata = {
930- ...resumedSnapshot . metadata ,
931- resumeFromSnapshot : true ,
932- resumeTerminalNoop : true ,
933- } as any
934- ; ( resumedSnapshot as any ) . workflow = pausedWorkflow
935939
936940 await executeWorkflowCore ( {
937- snapshot : resumedSnapshot as any ,
941+ snapshot : createDraftResumeSnapshot ( pausedWorkflow ) ,
938942 callbacks : { } ,
939- loggingSession : loggingSession as any ,
943+ loggingSession : loggingSession as unknown as LoggingSession ,
940944 skipLogCreation : true ,
941945 } )
942946
@@ -947,18 +951,11 @@ describe('executeWorkflowCore terminal finalization sequencing', () => {
947951 } )
948952
949953 it ( 'fails a draft resume whose snapshot lost its paused graph' , async ( ) => {
950- const resumedSnapshot = createSnapshot ( )
951- resumedSnapshot . metadata = {
952- ...resumedSnapshot . metadata ,
953- resumeFromSnapshot : true ,
954- } as any
955- ; ( resumedSnapshot as any ) . workflow = undefined
956-
957954 await expect (
958955 executeWorkflowCore ( {
959- snapshot : resumedSnapshot as any ,
956+ snapshot : createDraftResumeSnapshot ( undefined ) ,
960957 callbacks : { } ,
961- loggingSession : loggingSession as any ,
958+ loggingSession : loggingSession as unknown as LoggingSession ,
962959 skipLogCreation : true ,
963960 } )
964961 ) . rejects . toThrow ( 'Draft resume is missing the workflow graph it paused on' )
0 commit comments