@@ -436,17 +436,21 @@ describe("Graph", function () {
436436 . addEdge ( "a" , "e" )
437437 . addEdge ( "e" , "f" )
438438 . addEdge ( "f" , "c" ) ;
439+ const serializedGraph = graph . serialize ( ) ;
439440 assert . deepEqual ( graph . shortestPaths ( "a" , "c" ) , [
440441 withWeight ( [ "a" , "b" , "c" ] , 2 ) ,
441442 withWeight ( [ "a" , "d" , "c" ] , 2 ) ,
442443 ] ) ;
443- // need to check nodes are still present because we remove them to get all shortest paths
444- const nodes = [ "a" , "b" , "c" , "d" , "e" , "f" ] ;
445- assert . equal ( graph . nodes ( ) . length , nodes . length ) ;
446- nodes . forEach ( ( node ) => assert ( contains ( graph . nodes ( ) , node ) ) ) ;
447- // check edges are still there and no new have been added
448- assert . deepEqual ( graph . hasEdge ( "a" , "b" ) , true ) ;
449- assert . deepEqual ( graph . hasEdge ( "b" , "a" ) , false ) ;
444+ // check graph has not changed
445+ const postSerializedGraph = graph . serialize ( ) ;
446+ assert . equal (
447+ postSerializedGraph . links . length ,
448+ serializedGraph . links . length ,
449+ ) ;
450+ assert . equal (
451+ postSerializedGraph . nodes . length ,
452+ serializedGraph . nodes . length ,
453+ ) ;
450454 } ) ;
451455 } ) ;
452456
0 commit comments