Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

test: type Linux download fallback fixture

Richie McIlroy4d8c1fb3e7af
diff --git a/apps/web/__tests__/unit/download-route.test.ts b/apps/web/__tests__/unit/download-route.test.ts
index 1d10aac57..2a02d09b7 100644
--- a/apps/web/__tests__/unit/download-route.test.ts
+++ b/apps/web/__tests__/unit/download-route.test.ts
@@ -49,26 +49,31 @@ describe("desktop download route", () => {
});
it.each([
- ["linux-appimage", "linux-appimage", "https://github.com/cap.AppImage"],
- ["linux-rpm", "linux-rpm", "https://github.com/cap.rpm"],
- ["linux-pacman", "linux-pacman", "https://github.com/cap.pkg.tar.zst"],
- ])(
- "keeps the %s download format in the fallback",
- async (platform, key, url) => {
- vi.stubGlobal(
- "fetch",
- vi.fn().mockRejectedValue(new Error("Unavailable")),
- );
- vi.mocked(getGitHubReleases).mockResolvedValue([
- { downloads: { [key]: url } },
- ] as Awaited<ReturnType<typeof getGitHubReleases>>);
- const response = await GET(request, {
- params: Promise.resolve({ platform }),
- });
- expect(response.headers.get("location")).toBe(url);
- vi.unstubAllGlobals();
- },
- );
+ ["linux-appimage", "https://github.com/cap.AppImage"],
+ ["linux-rpm", "https://github.com/cap.rpm"],
+ ["linux-pacman", "https://github.com/cap.pkg.tar.zst"],
+ ])("keeps the %s download format in the fallback", async (platform, url) => {
+ vi.stubGlobal("fetch", vi.fn().mockRejectedValue(new Error("Unavailable")));
+ vi.mocked(getGitHubReleases).mockResolvedValue([
+ {
+ version: "0.6.0",
+ tagName: "cap-v0.6.0",
+ publishedAt: "2026-09-15T13:10:21Z",
+ body: "",
+ htmlUrl: "https://github.com/CapSoftware/Cap/releases/tag/cap-v0.6.0",
+ downloads: {
+ "linux-appimage": "https://github.com/cap.AppImage",
+ "linux-rpm": "https://github.com/cap.rpm",
+ "linux-pacman": "https://github.com/cap.pkg.tar.zst",
+ },
+ },
+ ]);
+ const response = await GET(request, {
+ params: Promise.resolve({ platform }),
+ });
+ expect(response.headers.get("location")).toBe(url);
+ vi.unstubAllGlobals();
+ });
it("preserves a successful redirect when probe cancellation fails", async () => {
vi.stubGlobal(