We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a18f10 commit ae3b7fbCopy full SHA for ae3b7fb
Graphs/test/TarjanSCC.test.js
@@ -70,3 +70,23 @@ test('Test Case 4 - Complex Graph', () => {
70
71
expect(actual).toEqual(expect.arrayContaining(expected))
72
})
73
+
74
+test('Edge Case - Null input should throw error', () => {
75
+ expect(() => TarjanSCC(null)).toThrow(
76
+ 'Graph must be a non-null object representing an adjacency list'
77
+ )
78
+})
79
80
+test('Edge Case - Node with non-array neighbors should throw error', () => {
81
+ const graph = {
82
+ A: 'not-an-array'
83
+ }
84
+ expect(() => TarjanSCC(graph)).toThrow('Neighbors of node A must be an array')
85
86
87
+test('Edge Case - Neighbor not in graph should throw error', () => {
88
89
+ A: ['B']
90
91
+ expect(() => TarjanSCC(graph)).toThrow('Node B not found in graph')
92
0 commit comments