Fix tests for edge-induced graph disequality (#299)

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
This commit is contained in:
William Chargin 2018-05-25 18:40:49 -07:00 committed by GitHub
parent 853518fd60
commit d8fef6bf47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 6 deletions

View File

@ -859,14 +859,25 @@ describe("graph", () => {
address: demoData.makeAddress("hinox", "NPC"), address: demoData.makeAddress("hinox", "NPC"),
payload: {status: "sleeping"}, payload: {status: "sleeping"},
}); });
it("returns false when the LHS has edges missing in the RHS", () => { const extraEdge = () => ({
const g1 = demoData.mealGraph(); address: demoData.makeAddress(
const g2 = demoData.mealGraph().addNode(extraNode1()); "octorok@helps_cook@seafood_fruit_mix#3",
expect(g1.equals(g2)).toBe(false); "ACTION"
),
src: demoData.mealNode().address,
dst: extraNode1().address,
payload: {helpfulness: "very"},
}); });
it("returns false when the LHS has edges missing in the RHS", () => { it("returns false when the LHS has edges missing in the RHS", () => {
const g1 = demoData.mealGraph().addNode(extraNode1()); const baseGraph = () => demoData.mealGraph().addNode(extraNode1());
const g2 = demoData.mealGraph(); 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); expect(g1.equals(g2)).toBe(false);
}); });
it("returns true when nodes are added in different orders", () => { it("returns true when nodes are added in different orders", () => {