Files
better-auth/docs/lib/page-tree.test.ts
T

29 lines
643 B
TypeScript

import { describe, expect, it } from "vitest";
import { isPathWithinFolderIndex } from "./page-tree";
describe("isPathWithinFolderIndex", () => {
it("matches a folder index and its hidden descendants", () => {
expect(
isPathWithinFolderIndex(
"/docs/reference/errors",
"/docs/reference/errors",
),
).toBe(true);
expect(
isPathWithinFolderIndex(
"/docs/reference/errors",
"/docs/reference/errors/unknown",
),
).toBe(true);
});
it("does not match sibling paths", () => {
expect(
isPathWithinFolderIndex(
"/docs/reference/errors",
"/docs/reference/resources",
),
).toBe(false);
});
});