# test.govlab/docs/core/stores/graph.store.test.ts

> 18 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-govlab-docs-core-stores-graph-store-test-ts
Source text: https://banes-lab.com/source/testing/test.govlab/docs/core/stores/graph.store.test.ts.txt

Listed in [test.govlab/docs/core/stores](https://banes-lab.com/api/source/testing/test.govlab/docs/core/stores.md).

## Contained in

- [test.govlab/docs/core/stores](https://banes-lab.com/anatomy/testing/folder-testing-test-govlab-docs-core-stores.md)

## Source

```typescript
import { describe, expect, it } from "vitest";
import { GraphStore } from "@govlab/docs/core/stores/graph.store.ts";

describe("GraphStore", () => {
    it("keeps the first node per id, every edge, the visited set and the unresolved tally", () => {
        const store = new GraphStore();
        const source = { file: "a.ts", line: 1 };
        store.addNode({ id: "a", kind: "entry", label: "first", source });
        store.addNode({ id: "a", kind: "entry", label: "second", source });
        store.pushEdge({ from: "a", kind: "call", to: "a" });
        store.markVisited("a");
        store.bumpUnresolved();
        expect(store.result()).toStrictEqual({
            edges: [{ from: "a", kind: "call", to: "a" }],
            nodes: [{ id: "a", kind: "entry", label: "first", source }],
        });
        expect([store.hasVisited("a"), store.hasVisited("b"), store.unresolved]).toStrictEqual([true, false, 1]);
    });
});
```
