Open History to see the last commit
1import { afterEach, describe, expect, it, vi } from "vite-plus/test";
2
3import { fetchLatestRelease } from "./releases";
4
5afterEach(() => {
6 vi.unstubAllGlobals();
7});
8
9describe("fetchLatestRelease", () => {
10 it("rejects a GitHub API error response instead of returning it as a release", async () => {
11 vi.stubGlobal("sessionStorage", { getItem: () => null });
12 vi.stubGlobal("fetch", async () =>
13 Response.json({ message: "API rate limit exceeded" }, { status: 403 }),
14 );
15
16 await expect(fetchLatestRelease("stable")).rejects.toThrow("403");
17 });
18});