25 lines
659 B
TypeScript
25 lines
659 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { isPublicPath } from "./publicPaths";
|
|
|
|
describe("isPublicPath", () => {
|
|
it.each([
|
|
"/login",
|
|
"/api/auth/login",
|
|
"/api/health",
|
|
"/shared/class/quizzes/token",
|
|
"/_next/static/chunk.js",
|
|
"/favicon.ico",
|
|
])("allows intentional public path %s", (pathname) => {
|
|
expect(isPublicPath(pathname)).toBe(true);
|
|
});
|
|
|
|
it.each([
|
|
"/private/file.txt",
|
|
"/api/decks/file.json",
|
|
"/api/authentication/fake",
|
|
"/shared-secret",
|
|
"/private/%2e%2e/data",
|
|
])("does not bypass authentication for %s", (pathname) => {
|
|
expect(isPublicPath(pathname)).toBe(false);
|
|
});
|
|
});
|