# test.build/core/guards/catalog.guard.test.ts

> 15 lines of code and 0 definitions.

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

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

## Contained in

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

## Source

```typescript
import { DISCOVERY, HOME } from "../converters/site.fixture.ts";
import { describe, expect, it } from "vitest";
import { API_SEGMENT } from "@banes-lab/build-scripts/configuration/constants/catalog.constants.ts";
import { guardPages } from "@banes-lab/build-scripts/core/guards/catalog.guard.ts";

describe("guardPages", () => {
    it("accepts page ids clear of the catalog segments and refuses one that collides", () => {
        expect(() => {
            guardPages(DISCOVERY);
        }).not.toThrow();
        const colliding = { ...DISCOVERY, pages: [{ ...HOME, id: API_SEGMENT }] };
        expect(() => {
            guardPages(colliding);
        }).toThrow(`"${API_SEGMENT}"`);
    });
});
```
