Skip to content

Commit 877b860

Browse files
committed
test: tighten custom theme fetch assertion
1 parent ef2be8a commit 877b860

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

ui/src/ui/custom-theme.test.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,18 @@ describe("custom theme import helpers", () => {
179179
);
180180

181181
expect(imported.label).toBe("Light Green");
182-
expect(fetchImpl).toHaveBeenCalledWith(
183-
"https://tweakcn.com/r/themes/cmlhfpjhw000004l4f4ax3m7z",
184-
expect.objectContaining({
185-
headers: { accept: "application/json" },
186-
redirect: "error",
187-
signal: expect.any(AbortSignal),
188-
}),
189-
);
182+
const fetchMock = vi.mocked(fetchImpl);
183+
expect(fetchMock).toHaveBeenCalledTimes(1);
184+
const [fetchUrl, fetchOptions] = fetchMock.mock.calls[0] as [
185+
string,
186+
{ headers?: unknown; redirect?: unknown; signal?: unknown },
187+
];
188+
expect(fetchUrl).toBe("https://tweakcn.com/r/themes/cmlhfpjhw000004l4f4ax3m7z");
189+
expect(fetchOptions).toMatchObject({
190+
headers: { accept: "application/json" },
191+
redirect: "error",
192+
});
193+
expect(fetchOptions.signal).toBeInstanceOf(AbortSignal);
190194
});
191195

192196
it("rejects oversized tweakcn theme responses before parsing", async () => {

0 commit comments

Comments
 (0)