chore: add latest test case
This commit is contained in:
parent
0e6cdcbc35
commit
aa3fc1a3ec
@ -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")}`;
|
||||
}
|
||||
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -27,12 +27,6 @@ describe("isWindowsArm64Supported", () => {
|
||||
});
|
||||
|
||||
describe("getArchitecture", () => {
|
||||
let warningSpy: ReturnType<typeof spyOn>;
|
||||
|
||||
afterEach(() => {
|
||||
warningSpy?.mockRestore();
|
||||
});
|
||||
|
||||
it("should return aarch64 for arm64 architecture on all platforms", () => {
|
||||
expect(getArchitecture("arm64")).toBe("aarch64");
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user