Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

891 B
Raw Blame
import { expect, it, vi } from "vite-plus/test";
import { auth } from "../../apps/api/src/auth";

vi.hoisted(() => {
  process.env.DISABLE_LOGIN_FORM = "true";
});

it.each([
  ["/request-password-reset", "POST", { email: "[email protected]" }],
  ["/reset-password", "POST", { token: "token", newPassword: "new-password" }],
  [
    "/reset-password/token?callbackURL=http://localhost:5173/auth/reset-password",
    "GET",
    undefined,
  ],
] as const)(
  "blocks %s when local login is disabled",
  async (path, method, body) => {
    const response = await auth.handler(
      new Request(`http://localhost:1337/api/auth${path}`, {
        method,
        headers: {
          "content-type": "application/json",
          Origin: "http://localhost:5173",
        },
        body: body ? JSON.stringify(body) : undefined,
      }),
    );
    expect(response.status).toBe(403);
  },
);