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:
William Chargin 2018-03-02 20:46:35 -08:00 committed by GitHub
parent 2e5bea2f5e
commit 5a2380d486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 21 deletions

View File

@ -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