Skip to content

Commit a980c95

Browse files
committed
test: check shouldFollow function receive all expected arguments
1 parent 342641f commit a980c95

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/algorithms/depthFirstSearch/depthFirstSearch.spec.ts

+17
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)