# test.govlab/patterns/core/converters/definition.converter.test.ts

> 14 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-govlab-patterns-core-converters-definition-converter-test-ts
Source text: https://banes-lab.com/source/testing/test.govlab/patterns/core/converters/definition.converter.test.ts.txt

Listed in [test.govlab/patterns/core/converters](https://banes-lab.com/api/source/testing/test.govlab/patterns/core/converters.md), after [test.govlab/patterns/core/converters/code.converter.test.ts](https://banes-lab.com/source/testing/test.govlab/patterns/core/converters/code.converter.test.ts.md) and before [test.govlab/patterns/core/converters/field.converter.test.ts](https://banes-lab.com/source/testing/test.govlab/patterns/core/converters/field.converter.test.ts.md).

## Contained in

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

## Source

```typescript
import { call, definition } from "../analyzers/code.fixture.ts";
import { codeGraph, codeInsight } from "@govlab/patterns/core/analyzers/code.analyzer.ts";
import { describe, expect, it } from "vitest";
import { definitionRecords } from "@govlab/patterns/core/converters/definition.converter.ts";

describe("definitionRecords", () => {
    it("lists each definition's callers and callees by key", () => {
        const symbols = [definition("caller", "a.ts"), call("callee", "caller", "a.ts"), definition("callee", "b.ts")];
        const records = definitionRecords(codeInsight(symbols, []), codeGraph(symbols));
        const callee = records.find((record) => record.name === "callee");
        const caller = records.find((record) => record.name === "caller");
        expect(callee?.callers).toStrictEqual(["a.ts::caller"]);
        expect(caller?.callees).toStrictEqual(["b.ts::callee"]);
    });
});
```
