@@ -197,4 +197,29 @@ describe("GraphBuilder", () => {
197
197
{ from : "issue3" , to : "finish" } ,
198
198
] ) ;
199
199
} ) ;
200
+
201
+ it ( "Add dependency before adding node" , ( ) => {
202
+ const graphBuilder = new GraphBuilder ( true ) ;
203
+
204
+ graphBuilder . addIssue (
205
+ { repoOwner : "A" , repoName : "B" , issueNumber : 1 } ,
206
+ new MermaidNode ( "issue1" , "Test issue 1" , "notstarted" )
207
+ ) ;
208
+ graphBuilder . addDependency (
209
+ { repoOwner : "A" , repoName : "B" , issueNumber : 1 } ,
210
+ { repoOwner : "A" , repoName : "B" , issueNumber : 2 }
211
+ ) ;
212
+ graphBuilder . addIssue (
213
+ { repoOwner : "A" , repoName : "B" , issueNumber : 2 } ,
214
+ new MermaidNode ( "issue2" , "Test issue 2" , "started" )
215
+ ) ;
216
+
217
+ const actual = extractNodeIdFromGraph ( graphBuilder . getGraph ( ) ) ;
218
+ expect ( actual . vertices ) . toEqual ( [ "start" , "issue1" , "issue2" , "finish" ] ) ;
219
+ expect ( actual . edges ) . toEqual ( [
220
+ { from : "start" , to : "issue1" } ,
221
+ { from : "issue1" , to : "issue2" } ,
222
+ { from : "issue2" , to : "finish" } ,
223
+ ] ) ;
224
+ } ) ;
200
225
} ) ;
0 commit comments