From d8fef6bf47a1500a591cc7f55ee320ea437c0ae5 Mon Sep 17 00:00:00 2001 From: William Chargin Date: Fri, 25 May 2018 18:40:49 -0700 Subject: [PATCH] Fix tests for edge-induced graph disequality (#299) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: These tests have apparently been borked since the beginning. They were testing properties about nodes instead of edges, had the wrong test names, and had the LHS/RHS backward… this should make them more useful. Test Plan: Unit tests suffice, I suppose. wchargin-branch: tests-for-missing-edges --- src/core/graph.test.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/core/graph.test.js b/src/core/graph.test.js index e83de74..cd318cc 100644 --- a/src/core/graph.test.js +++ b/src/core/graph.test.js @@ -859,14 +859,25 @@ describe("graph", () => { address: demoData.makeAddress("hinox", "NPC"), payload: {status: "sleeping"}, }); - it("returns false when the LHS has edges missing in the RHS", () => { - const g1 = demoData.mealGraph(); - const g2 = demoData.mealGraph().addNode(extraNode1()); - expect(g1.equals(g2)).toBe(false); + const extraEdge = () => ({ + address: demoData.makeAddress( + "octorok@helps_cook@seafood_fruit_mix#3", + "ACTION" + ), + src: demoData.mealNode().address, + dst: extraNode1().address, + payload: {helpfulness: "very"}, }); it("returns false when the LHS has edges missing in the RHS", () => { - const g1 = demoData.mealGraph().addNode(extraNode1()); - const g2 = demoData.mealGraph(); + const baseGraph = () => demoData.mealGraph().addNode(extraNode1()); + const g1 = baseGraph().addEdge(extraEdge()); + const g2 = baseGraph(); + expect(g1.equals(g2)).toBe(false); + }); + it("returns false when the RHS has edges missing in the LHS", () => { + const baseGraph = () => demoData.mealGraph().addNode(extraNode1()); + const g1 = baseGraph(); + const g2 = baseGraph().addEdge(extraEdge()); expect(g1.equals(g2)).toBe(false); }); it("returns true when nodes are added in different orders", () => {