mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { afterAll, describe, expect, test } from "bun:test";
|
|
import { fakeRequest, getTestUsers } from "~/tests/utils";
|
|
|
|
const { deleteUsers, tokens } = await getTestUsers(1);
|
|
|
|
afterAll(async () => {
|
|
await deleteUsers();
|
|
});
|
|
|
|
// /api/v1/sso/:id
|
|
describe("/api/v1/sso/:id", () => {
|
|
test("should not find unknown issuer", async () => {
|
|
const response = await fakeRequest("/api/v1/sso/unknown", {
|
|
method: "GET",
|
|
headers: {
|
|
Authorization: `Bearer ${tokens[0]?.accessToken}`,
|
|
},
|
|
});
|
|
|
|
expect(response.status).toBe(404);
|
|
expect(await response.json()).toMatchObject({
|
|
error: "Issuer with ID unknown not found in instance's OpenID configuration",
|
|
});
|
|
|
|
const response2 = await fakeRequest("/api/v1/sso/unknown", {
|
|
method: "DELETE",
|
|
headers: {
|
|
Authorization: `Bearer ${tokens[0]?.accessToken}`,
|
|
"Content-Type": "application/json",
|
|
},
|
|
});
|
|
|
|
expect(response2.status).toBe(404);
|
|
expect(await response2.json()).toMatchObject({
|
|
error: "Issuer with ID unknown not found in instance's OpenID configuration",
|
|
});
|
|
});
|
|
});
|