# test.build/core/selectors/page.selector.test.ts

> 10 lines of code and 0 definitions.

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

Listed in [test.build/core/selectors](https://banes-lab.com/api/source/testing/test.build/core/selectors.md), after [test.build/core/selectors/markup.selector.test.ts](https://banes-lab.com/source/testing/test.build/core/selectors/markup.selector.test.ts.md) and before [test.build/core/selectors/record.selector.test.ts](https://banes-lab.com/source/testing/test.build/core/selectors/record.selector.test.ts.md).

## Contained in

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

## Source

```typescript
import { describe, expect, it } from "vitest";
import { definitionOf } from "@banes-lab/build-scripts/core/selectors/page.selector.ts";

const TERMS = { content: null, description: "The terms.", id: "terms", title: "Terms" };
const LOADED = { registry: { loadedPage: (page: string) => (page === TERMS.id ? TERMS : undefined) } };

describe("definitionOf", () => {
    it("returns a registered page and refuses an id no view registers", () => {
        expect(definitionOf(LOADED, "terms")).toBe(TERMS);
        expect(() => definitionOf(LOADED, "gone")).toThrow('"gone"');
    });
});
```
