Skip to content

Commit 6823897

Browse files
committed
Add test case for no path
1 parent 346fc06 commit 6823897

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/graphs/searching/bfs.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,13 @@ describe('BFS', function () {
2525
expect(bfs(graph, 0, 2)).toEqual([0, 4, 3, 2]);
2626
});
2727

28+
it('should return falsy value when there\'s no path', function () {
29+
var graph = [[0, 0, 0, 0, 1],
30+
[0, 0, 0, 1, 0],
31+
[0, 0, 0, 0, 0],
32+
[1, 0, 0, 0, 0],
33+
[0, 1, 0, 1, 0]];
34+
expect(bfs(graph, 0, 2)).toBeFalsy();
35+
});
36+
2837
});

0 commit comments

Comments
 (0)