Refactor Study Desk application structure
This commit is contained in:
parent
faaccf8a7e
commit
089439ed90
145 changed files with 8087 additions and 3412 deletions
25
src/lib/publicPaths.test.ts
Normal file
25
src/lib/publicPaths.test.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue