test(dawarich): cover the daily values, the refusals and the backup ends

A stub Dawarich instance on the loopback interface drives the shipped routes
and the sync against real SQL. Unit tests pin the parsers, the time-away
arithmetic, the origin grant, the travel runs, the places route's no-write
rule, the backup pair and the schema's no-location rule.
This commit is contained in:
Marc-André Bombeck committed 2026-10-16 01:23:26 +02:00
1 parent b838ed4403
commit b99bcaeec6
2 files changed
+518 -2

No files matched your search

@@ -92,7 +92,6 @@ describe("GET /api/dawarich/places", () => {
]);
const res = (await GET(
new NextRequest("http://localhost/api/dawarich/places?q=o"),
undefined as never,
)) as Response;
expect(res.status).toBe(200);
const body = await res.json();
@@ -112,7 +111,6 @@ describe("GET /api/dawarich/places", () => {
fetchPlacesMock.mockRejectedValue(new Error("ECONNREFUSED"));
const res = (await GET(
new NextRequest("http://localhost/api/dawarich/places"),
undefined as never,
)) as Response;
expect(res.status).toBe(502);
expect((await res.json()).meta.errorCode).toBe("dawarich.unreachable");