Skip to content

Commit 0bb0851

Browse files
🔬 test: Increase coverage by testing graphs with cycles.
1 parent 418872d commit 0bb0851

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/src/api.js

+10
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,13 @@ test('fewest edges first', (t) => {
4141
const result = [...sorted(edges, breakTies)];
4242
t.deepEqual(result, expected);
4343
});
44+
45+
test('Triangle', (t) => {
46+
const edges = ['ab', 'bc', 'ca'];
47+
t.throws(() => [...sorted(edges)], {message: /cycle/});
48+
});
49+
50+
test('Triangle after edge', (t) => {
51+
const edges = ['xa', 'ab', 'bc', 'ca'];
52+
t.throws(() => [...sorted(edges)], {message: /cycle/});
53+
});

0 commit comments

Comments
 (0)