You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
875 B
25 lines
875 B
import { describe, expect, test } from "bun:test";
|
|
|
|
process.env.DATABASE_URL ??= "postgres://localhost:5432/person_panel_test";
|
|
|
|
import { AuthValidationError, loginUser, registerUser } from "./index";
|
|
|
|
describe("auth payload validation", () => {
|
|
test("registerUser rejects payloads with a missing password as validation errors", async () => {
|
|
await expect(
|
|
registerUser({
|
|
username: "valid_user",
|
|
password: undefined as never,
|
|
}),
|
|
).rejects.toBeInstanceOf(AuthValidationError);
|
|
});
|
|
|
|
test("loginUser rejects payloads with a missing password as validation errors", async () => {
|
|
await expect(
|
|
loginUser({
|
|
username: "valid_user",
|
|
password: undefined as never,
|
|
}),
|
|
).rejects.toBeInstanceOf(AuthValidationError);
|
|
});
|
|
});
|
|
|