test.build/core/predicates/route.predicate.test.ts

test.build/core/predicates/route.predicate.test.ts is a file in Codebase Testing. 18 lines of code and 0 definitions.

import { describe, expect, it } from "vitest";
import { FILE_ROUTES } from "@banes-lab/build-scripts/configuration/constants/site.constants.ts";
import { isFileRoute, isSourceFilePage } from "@banes-lab/build-scripts/core/predicates/route.predicate.ts";

describe("isFileRoute", () => {
    it("accepts an address under every served file route and refuses a page address", () => {
        expect(FILE_ROUTES.every((route) => isFileRoute(`${route}a.png`))).toBe(true);
        expect(isFileRoute("/terms")).toBe(false);
        expect(isFileRoute("/json/terms")).toBe(false);
    });
});

describe("isSourceFilePage", () => {
    it("accepts a source file page and refuses a folder page, a tab and a page", () => {
        expect(isSourceFilePage("/anatomy/tree/file-vite-config-ts")).toBe(true);
        expect(isSourceFilePage("/anatomy/tree/folder-core")).toBe(false);
        expect(isSourceFilePage("/anatomy/tree")).toBe(false);
        expect(isSourceFilePage("/file-terms/guide")).toBe(false);
    });
});