MCPcopy Create free account
hub / github.com/apache/fory / assertGraphEqual

Function assertGraphEqual

integration_tests/idl_tests/javascript/roundtrip.ts:809–858  ·  view source on GitHub ↗
(expected: Graph, actualValue: unknown)

Source from the content-addressed store, hash-verified

807}
808
809function assertGraphEqual(expected: Graph, actualValue: unknown): void {
810 assert.ok(
811 actualValue != null && typeof actualValue === "object",
812 "graph payload must decode to an object",
813 );
814 const actual = actualValue as Graph;
815 assert.equal(
816 actual.nodes.length,
817 expected.nodes.length,
818 "graph node size mismatch",
819 );
820 assert.equal(
821 actual.edges.length,
822 expected.edges.length,
823 "graph edge size mismatch",
824 );
825 assert.equal(expected.nodes.length, 2, "expected graph fixture drift");
826 assert.equal(expected.edges.length, 1, "expected graph edge fixture drift");
827 const actualNodeA = actual.nodes[0];
828 const actualNodeB = actual.nodes[1];
829 const actualEdge = actual.edges[0];
830 assert.equal(
831 actualNodeA.id,
832 expected.nodes[0].id,
833 "graph node-a id mismatch",
834 );
835 assert.equal(
836 actualNodeB.id,
837 expected.nodes[1].id,
838 "graph node-b id mismatch",
839 );
840 assert.equal(actualEdge.id, expected.edges[0].id, "graph edge id mismatch");
841 assert.equal(
842 actualEdge.weight,
843 expected.edges[0].weight,
844 "graph edge weight mismatch",
845 );
846 assert.strictEqual(
847 actualNodeA.outEdges[0],
848 actualNodeA.inEdges[0],
849 "graph shared edge mismatch",
850 );
851 assert.strictEqual(
852 actualEdge,
853 actualNodeA.outEdges[0],
854 "graph edge link mismatch",
855 );
856 assert.strictEqual(actualEdge.from_, actualNodeA, "graph edge from mismatch");
857 assert.strictEqual(actualEdge.to, actualNodeB, "graph edge to mismatch");
858}
859
860function runStandardRoundTrip(compatible: boolean): void {
861 // AddressBook registration already includes the shared complex_pb types.

Callers

nothing calls this directly

Calls 2

okMethod · 0.45
equalMethod · 0.45

Tested by

no test coverage detected