Skip to content

Commit 12fd9e4

Browse files
didrod205claude
andcommitted
fix(test): type the caught error in the fetchJson HttpError test
tsc (typecheck) flagged `err` as unknown; cast to HttpError for the status assertion. vitest passed locally but the CI typecheck step caught it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3c8e27e commit 12fd9e4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

test/fetchwise.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,11 @@ describe("fetchJson & HttpError", () => {
244244

245245
it("throws HttpError (with status + response) on a non-2xx", async () => {
246246
vi.stubGlobal("fetch", vi.fn().mockResolvedValue(jsonRes(404, { error: "missing" })));
247-
const err = await fetchJson("https://x.test/missing", { retry: { retries: 0 } }).catch((e) => e);
247+
const err = await fetchJson("https://x.test/missing", { retry: { retries: 0 } }).catch(
248+
(e: unknown) => e,
249+
);
248250
expect(err).toBeInstanceOf(HttpError);
249-
expect(err.status).toBe(404);
251+
expect((err as HttpError).status).toBe(404);
250252
});
251253

252254
it("returns undefined for 204 No Content", async () => {

0 commit comments

Comments
 (0)