test: cover auth password reset smoke

This commit is contained in:
2026-06-10 03:19:32 -07:00
parent 0b76c7edb0
commit 71c845ec8a

View File

@@ -62,6 +62,24 @@ describe("cfw-auth worker", () => {
expect(response.headers.get("access-control-allow-origin")).toBe("http://localhost:8787");
});
it("handles password reset requests without exposing account existence", async () => {
const response = await worker.fetch(
new Request("http://auth.local/api/auth/request-password-reset", {
method: "POST",
headers: {
"Content-Type": "application/json",
Origin: "http://localhost:8787",
},
body: JSON.stringify({
email: "missing@example.com",
redirectTo: "http://localhost:8787/reset-password",
}),
}),
env,
);
expect([200, 400, 403]).toContain(response.status);
});
it("does not route non-GET/POST auth requests to Better Auth", async () => {
const response = await worker.fetch(
new Request("http://auth.local/api/auth/session", {