# test.build/core/loaders/build.loader.test.ts

> 30 lines of code and 0 definitions.

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

Listed in [test.build/core/loaders](https://banes-lab.com/api/source/testing/test.build/core/loaders.md), before [test.build/core/loaders/coordination.fixture.ts](https://banes-lab.com/source/testing/test.build/core/loaders/coordination.fixture.ts.md).

## Contained in

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

## Source

```typescript
import {
    buildOutput,
    bytesOrNull,
    pageIds,
    readOrNull,
    sourcePagePaths,
} from "@banes-lab/build-scripts/core/loaders/build.loader.ts";
import { describe, expect, it } from "vitest";
import { absolutePath } from "@ssot/paths";

describe("buildOutput and readOrNull", () => {
    it("reads under the site build folder and answers null for a file the build did not write", () => {
        expect(buildOutput()).toBe(absolutePath("builds.web"));
        expect(readOrNull("no/such/file.txt")).toBeNull();
        expect(bytesOrNull("no/such/file.png")).toBeNull();
    });
});

describe("sourcePagePaths", () => {
    it("lists the pages below a page's tab folders as routes, and nothing for a folder the build did not write", () => {
        expect(sourcePagePaths("no-such-page")).toStrictEqual([]);
        const paths = sourcePagePaths("anatomy");
        expect(paths.every((path) => path.startsWith("/anatomy/") && path.split("/").length === 4)).toBe(true);
    });
});

describe("pageIds", () => {
    it("lists every page id the web member declares", async () => {
        const ids = await pageIds();
        expect(ids.length).toBeGreaterThan(0);
        expect(new Set(ids).size).toBe(ids.length);
    });
});
```
