test: tighten custom theme fetch assertion

This commit is contained in:
Peter Steinberger
2026-05-09 04:48:43 +01:00
parent ef2be8a982
commit 877b860093

View File

@@ -179,14 +179,18 @@ describe("custom theme import helpers", () => {
);
expect(imported.label).toBe("Light Green");
expect(fetchImpl).toHaveBeenCalledWith(
"https://tweakcn.com/r/themes/cmlhfpjhw000004l4f4ax3m7z",
expect.objectContaining({
headers: { accept: "application/json" },
redirect: "error",
signal: expect.any(AbortSignal),
}),
);
const fetchMock = vi.mocked(fetchImpl);
expect(fetchMock).toHaveBeenCalledTimes(1);
const [fetchUrl, fetchOptions] = fetchMock.mock.calls[0] as [
string,
{ headers?: unknown; redirect?: unknown; signal?: unknown },
];
expect(fetchUrl).toBe("https://tweakcn.com/r/themes/cmlhfpjhw000004l4f4ax3m7z");
expect(fetchOptions).toMatchObject({
headers: { accept: "application/json" },
redirect: "error",
});
expect(fetchOptions.signal).toBeInstanceOf(AbortSignal);
});
it("rejects oversized tweakcn theme responses before parsing", async () => {