Skip to content

Commit 1c27c88

Browse files
authored
Merge pull request #100 from JesusTheHun/test/shouldFollow
Add a test to make sure that the function `shouldFollow` receives all expected arguments
2 parents a8453be + a980c95 commit 1c27c88

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/algorithms/depthFirstSearch/depthFirstSearch.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,21 @@ describe('depthFirstSearch', () => {
1919
expect(nodes).toContain('b');
2020
expect(nodes).toContain('e');
2121
});
22+
23+
it('should pass all the expected args to the shouldFollow function', function () {
24+
expect.hasAssertions();
25+
26+
const graph = new Graph<string, { type: string }>();
27+
28+
graph.addEdge('a', 'b', { props: { type: 'foo' } });
29+
30+
depthFirstSearch(graph, {
31+
shouldFollow: ({ source, target, props }) => {
32+
expect(source).toEqual(expect.any(String));
33+
expect(target).toEqual(expect.any(String));
34+
expect(props).toEqual({ type: 'foo' });
35+
return true;
36+
},
37+
});
38+
});
2239
});

0 commit comments

Comments
 (0)