# test.build/core/resolvers/diagram.resolver.test.ts

> 17 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-build-core-resolvers-diagram-resolver-test-ts
Source text: https://banes-lab.com/source/testing/test.build/core/resolvers/diagram.resolver.test.ts.txt

Listed in [test.build/core/resolvers](https://banes-lab.com/api/source/testing/test.build/core/resolvers.md), after [test.build/core/resolvers/catalog.resolver.test.ts](https://banes-lab.com/source/testing/test.build/core/resolvers/catalog.resolver.test.ts.md) and before [test.build/core/resolvers/evidence.resolver.test.ts](https://banes-lab.com/source/testing/test.build/core/resolvers/evidence.resolver.test.ts.md).

## Contained in

- [test.build/core/resolvers](https://banes-lab.com/anatomy/testing/folder-testing-test-build-core-resolvers.md)

## Source

```typescript
import { absolutePath, relativePath } from "@ssot/paths";
import { describe, expect, it } from "vitest";
import { diagramDigest, diagramFileName } from "@banes-lab/build-scripts/core/resolvers/diagram.resolver.ts";
import { DIAGRAM_ROOT } from "@banes-lab/web/core/assets/diagram.assets.ts";

const ABC_DIGEST = "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
const SLASH = "/";

describe("diagramDigest and diagramFileName", () => {
    it("names a vector by the standard digest of its source, marked as generated", () => {
        expect(diagramDigest("abc")).toBe(ABC_DIGEST);
        expect(diagramFileName("abc")).toBe(`diagram.${ABC_DIGEST}.generated.svg`);
    });

    it("writes the vectors where the site serves them", () => {
        const served = SLASH + relativePath("app.diagrams").slice(relativePath("app.public").length + 1) + SLASH;
        expect(served).toBe(DIAGRAM_ROOT);
        expect(absolutePath("app.diagrams").startsWith(absolutePath("app.public"))).toBe(true);
    });
});
```
