test: add portal end-to-end quality gates

This commit is contained in:
Leon Tonhäuser committed 2026-08-10 21:51:25 +02:00
1 parent f7481d4cde
commit 9c0d43b1ec
10 files changed
+609 -123

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
import { afterAll, beforeAll, describe, expect, test } from "vitest";
import { createFakeImmichServer } from "./server";
describe("createFakeImmichServer", () => {
const fakeImmich = createFakeImmichServer({ port: 0 });
let baseUrl = "";
beforeAll(async () => {
baseUrl = await fakeImmich.start();
});
afterAll(async () => {
await fakeImmich.stop();
});
test("serves album list", async () => {
const res = await fetch(`${baseUrl}/api/albums`, {
headers: { "x-api-key": "test-immich-api-key" },
});
expect(res.status).toBe(200);
const body = await res.json();
expect(body).toHaveLength(1);
expect(body[0].albumName).toBe("Presse 2026");
});
test("serves metadata search with album filter", async () => {
const res = await fetch(`${baseUrl}/api/search/metadata`, {
method: "POST",
headers: {
"content-type": "application/json",
"x-api-key": "test-immich-api-key",
},
body: JSON.stringify({ albumIds: ["album-1"], type: "IMAGE" }),
});
expect(res.status).toBe(200);
const body = await res.json();
expect(body.assets.total).toBe(2);
});
test("simulates outage mode", async () => {
fakeImmich.setOutage(true);
const res = await fetch(`${baseUrl}/api/albums`, {
headers: { "x-api-key": "test-immich-api-key" },
});
expect(res.status).toBe(503);
fakeImmich.setOutage(false);
});
});