Move `addNode`/`addEdge` tests away from getters (#60)
Summary: Nothing big; these were just organized wrong. wchargin-branch: test-reorg
This commit is contained in:
parent
2e5bea2f5e
commit
5a2380d486
|
@ -257,6 +257,29 @@ describe("graph", () => {
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("gets all nodes", () => {
|
||||||
|
const expected = [heroNode(), bananasNode(), crabNode(), mealNode()];
|
||||||
|
const actual = advancedMealGraph().getAllNodes();
|
||||||
|
expectSameSorted(expected, actual);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("gets all edges", () => {
|
||||||
|
const expected = [
|
||||||
|
pickEdge(),
|
||||||
|
grabEdge(),
|
||||||
|
cookEdge(),
|
||||||
|
bananasIngredientEdge(),
|
||||||
|
crabIngredientEdge(),
|
||||||
|
eatEdge(),
|
||||||
|
crabLoopEdge(),
|
||||||
|
duplicateCookEdge(),
|
||||||
|
];
|
||||||
|
const actual = advancedMealGraph().getAllEdges();
|
||||||
|
expectSameSorted(expected, actual);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("creating nodes and edges", () => {
|
||||||
it("forbids adding a node with existing address", () => {
|
it("forbids adding a node with existing address", () => {
|
||||||
expect(() =>
|
expect(() =>
|
||||||
simpleMealGraph().addNode({
|
simpleMealGraph().addNode({
|
||||||
|
@ -295,27 +318,6 @@ describe("graph", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("gets all nodes", () => {
|
|
||||||
const expected = [heroNode(), bananasNode(), crabNode(), mealNode()];
|
|
||||||
const actual = advancedMealGraph().getAllNodes();
|
|
||||||
expectSameSorted(expected, actual);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("gets all edges", () => {
|
|
||||||
const expected = [
|
|
||||||
pickEdge(),
|
|
||||||
grabEdge(),
|
|
||||||
cookEdge(),
|
|
||||||
bananasIngredientEdge(),
|
|
||||||
crabIngredientEdge(),
|
|
||||||
eatEdge(),
|
|
||||||
crabLoopEdge(),
|
|
||||||
duplicateCookEdge(),
|
|
||||||
];
|
|
||||||
const actual = advancedMealGraph().getAllEdges();
|
|
||||||
expectSameSorted(expected, actual);
|
|
||||||
});
|
|
||||||
|
|
||||||
// For the next two test cases: we're documenting this behavior,
|
// For the next two test cases: we're documenting this behavior,
|
||||||
// though we're not sure if it's the right behavior. Perhaps we want
|
// though we're not sure if it's the right behavior. Perhaps we want
|
||||||
// the namespaces to be forced to be disjoint. In that case, we can
|
// the namespaces to be forced to be disjoint. In that case, we can
|
||||||
|
|
Loading…
Reference in New Issue