File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -70,3 +70,23 @@ test('Test Case 4 - Complex Graph', () => {
70
70
71
71
expect ( actual ) . toEqual ( expect . arrayContaining ( expected ) )
72
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
+ const graph = {
89
+ A : [ 'B' ]
90
+ }
91
+ expect ( ( ) => TarjanSCC ( graph ) ) . toThrow ( 'Node B not found in graph' )
92
+ } )
You can’t perform that action at this time.
0 commit comments