diff --git a/src/utils.ts b/src/utils.ts index ac5ff9b..4b203a7 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -7,7 +7,6 @@ import { resolve, basename } from "node:path"; export const MIN_WINDOWS_ARM64_VERSION = "1.3.10"; - export function getCacheKey(url: string): string { return `bun-${createHash("sha1").update(url).digest("base64")}`; } diff --git a/tests/download-url.spec.ts b/tests/download-url.spec.ts index 5def07e..2644d8f 100644 --- a/tests/download-url.spec.ts +++ b/tests/download-url.spec.ts @@ -8,6 +8,7 @@ const MOCK_TAGS = [ { ref: "refs/tags/bun-v1.0.0" }, { ref: "refs/tags/bun-v1.0.1" }, { ref: "refs/tags/bun-v1.1.0" }, + { ref: "refs/tags/bun-v1.3.10" }, { ref: "refs/tags/canary" }, ]; @@ -99,7 +100,7 @@ describe("getDownloadUrl", () => { }); expect(url).toBe( - "https://github.com/oven-sh/bun/releases/download/bun-v1.1.0/bun-linux-x64.zip", + "https://github.com/oven-sh/bun/releases/download/bun-v1.3.10/bun-linux-x64.zip", ); expect(requestSpy).toHaveBeenCalledTimes(1); }); @@ -112,7 +113,7 @@ describe("getDownloadUrl", () => { }); expect(url).toBe( - "https://github.com/oven-sh/bun/releases/download/bun-v1.1.0/bun-linux-x64.zip", + "https://github.com/oven-sh/bun/releases/download/bun-v1.3.10/bun-linux-x64.zip", ); expect(requestSpy).toHaveBeenCalledTimes(1); }); @@ -202,6 +203,21 @@ describe("getDownloadUrl", () => { "https://github.com/oven-sh/bun/releases/download/canary/bun-windows-aarch64.zip", ); }); + + it("should use aarch64 for latest", async () => { + const warningSpy = spyOn(core, "warning"); + const url = await getDownloadUrl({ + version: "latest", + os: "windows", + arch: "arm64", + }); + + expect(url).toBe( + "https://github.com/oven-sh/bun/releases/download/bun-v1.3.10/bun-windows-aarch64.zip", + ); + expect(warningSpy).not.toHaveBeenCalled(); + warningSpy.mockRestore(); + }); }); }); diff --git a/tests/utils.spec.ts b/tests/utils.spec.ts index 255c24f..fc2e6bf 100644 --- a/tests/utils.spec.ts +++ b/tests/utils.spec.ts @@ -27,12 +27,6 @@ describe("isWindowsArm64Supported", () => { }); describe("getArchitecture", () => { - let warningSpy: ReturnType; - - afterEach(() => { - warningSpy?.mockRestore(); - }); - it("should return aarch64 for arm64 architecture on all platforms", () => { expect(getArchitecture("arm64")).toBe("aarch64"); });