File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -209,7 +209,12 @@ function getNextTask(
209209 taskName : string | undefined = undefined ,
210210 transition : string | undefined = undefined ,
211211) : TransitionInfo {
212- if ( ! tasksList ?. size ) throw new Error ( 'The task list cannot be empty. No tasks list to get the next task from.' ) ;
212+ if ( ! tasksList ?. size ) {
213+ return {
214+ name : FlowDirective . Exit ,
215+ index : - 1 ,
216+ } ;
217+ }
213218 const currentTask : Task | undefined = tasksList . get ( taskName || '' ) ;
214219 transition = transition || currentTask ?. then || '' ;
215220 if ( transition == FlowDirective . End || transition == FlowDirective . Exit ) {
Original file line number Diff line number Diff line change 136136 expect ( forSubgraph . nodes . length ) . toBe ( 3 ) ; // entry --> waitForCheckup --> exit
137137 expect ( forSubgraph . edges . length ) . toBe ( 2 ) ;
138138 } ) ;
139+
140+ it ( 'should build an empty graph' , ( ) => {
141+ const graph = buildGraph ( { } as Specification . Workflow ) ;
142+ expect ( graph ) . toBeDefined ( ) ;
143+ expect ( graph . nodes . length ) . toBe ( 2 ) ; // start --> end
144+ expect ( graph . edges . length ) . toBe ( 1 ) ;
145+ } ) ;
139146} ) ;
You can’t perform that action at this time.
0 commit comments