20 lines
547 B
TypeScript
20 lines
547 B
TypeScript
import { expect, test } from "vitest";
|
|
|
|
import { auth } from "./auth";
|
|
|
|
test("rejects direct Better Auth sign-up requests that bypass B2B registration", async () => {
|
|
const response = await auth.handler(
|
|
new Request("http://localhost:3000/api/auth/sign-up/email", {
|
|
method: "POST",
|
|
headers: { "content-type": "application/json" },
|
|
body: JSON.stringify({
|
|
email: "bypass@example.com",
|
|
name: "Bypass",
|
|
password: "sicheres-passwort-123",
|
|
}),
|
|
}),
|
|
);
|
|
|
|
expect(response.status).toBe(403);
|
|
});
|