Add tests for adding a conflicting edge (#366)
Adding a conflicting edge (i.e. one with the same address, but different `src` or `dst`) is an error. However, our coverage has determined that the behavior isn't tested. This commit adds that test. Test plan: Only change is adding a new test. Verify `yarn travis` passes.
This commit is contained in:
parent
d90cd3cf1b
commit
b8298123ef
|
@ -165,6 +165,21 @@ describe("core/graph", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("throws on conflicting edge", () => {
|
||||||
|
const src = NodeAddress.fromParts(["src"]);
|
||||||
|
const dst = NodeAddress.fromParts(["dst"]);
|
||||||
|
const address = EdgeAddress.fromParts(["hi"]);
|
||||||
|
const e1 = {src, dst, address};
|
||||||
|
const e2 = {src, dst: src, address};
|
||||||
|
const graph = new Graph()
|
||||||
|
.addNode(src)
|
||||||
|
.addNode(dst)
|
||||||
|
.addEdge(e1);
|
||||||
|
expect(() => graph.addEdge(e2)).toThrow(
|
||||||
|
"conflict between new edge"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
describe("throws on edge with", () => {
|
describe("throws on edge with", () => {
|
||||||
const n = NodeAddress.fromParts(["foo"]);
|
const n = NodeAddress.fromParts(["foo"]);
|
||||||
const e = EdgeAddress.fromParts(["bar"]);
|
const e = EdgeAddress.fromParts(["bar"]);
|
||||||
|
|
Loading…
Reference in New Issue