mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 11:20:37 +09:00
test: add over-broad route guard test and address Greptile review
This commit is contained in:
parent
a8638619e5
commit
fc8e1d1153
1 changed files with 9 additions and 0 deletions
|
|
@ -38,6 +38,15 @@ describe("Express 5 /api/auth wildcard route", () => {
|
||||||
expect(res.status).toBe(200);
|
expect(res.status).toBe(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not match unrelated paths outside /api/auth", async () => {
|
||||||
|
// Confirm the route is not over-broad — requests to other API paths
|
||||||
|
// must fall through to 404 and not reach the better-auth handler.
|
||||||
|
const { app, handler } = buildApp();
|
||||||
|
const res = await request(app).get("/api/other/endpoint");
|
||||||
|
expect(res.status).toBe(404);
|
||||||
|
expect(handler).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it("invokes the handler for every matched sub-path", async () => {
|
it("invokes the handler for every matched sub-path", async () => {
|
||||||
const { app, handler } = buildApp();
|
const { app, handler } = buildApp();
|
||||||
await request(app).post("/api/auth/sign-out");
|
await request(app).post("/api/auth/sign-out");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue