The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { describe, expect, it } from "@effect/vitest"; |
| 2 | import { antigravityCliTarget, parseAntigravityCliRelease } from "./antigravityCliRelease.ts"; |
| 3 | |
| 4 | const manifest = { |
| 5 | version: "1.5.7", |
| 6 | url: "https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.7-123/darwin-arm/cli_mac_arm64.tar.gz", |
| 7 | sha512: "a".repeat(128), |
| 8 | }; |
| 9 | |
| 10 | describe("Antigravity CLI release manifests", () => { |
| 11 | it.each([ |
| 12 | ["darwin", "arm64", false, "darwin_arm64", "darwin-arm/cli_mac_arm64.tar.gz"], |
| 13 | ["darwin", "x64", false, "darwin_amd64", "darwin-x64/cli_mac_x64.tar.gz"], |
| 14 | ["linux", "arm64", false, "linux_arm64", "linux-arm/cli_linux_arm64.tar.gz"], |
| 15 | ["linux", "x64", false, "linux_amd64", "linux-x64/cli_linux_x64.tar.gz"], |
| 16 | ["linux", "arm64", true, "linux_arm64_musl", "linux-arm-musl/cli_linux_arm64_musl.tar.gz"], |
| 17 | ["linux", "x64", true, "linux_amd64_musl", "linux-x64-musl/cli_linux_x64_musl.tar.gz"], |
| 18 | ["win32", "arm64", false, "windows_arm64", "windows-arm/cli_windows_arm64.exe"], |
| 19 | ["win32", "x64", false, "windows_amd64", "windows-x64/cli_windows_x64.exe"], |
| 20 | ] as const)("selects Google's %s-%s release (musl %s)", (platform, arch, musl, target, file) => { |
| 21 | expect(antigravityCliTarget(platform, arch, musl)).toBe(target); |
| 22 | expect( |
| 23 | parseAntigravityCliRelease( |
| 24 | { |
| 25 | ...manifest, |
| 26 | url: `https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.7-123/${file}`, |
| 27 | }, |
| 28 | platform, |
| 29 | arch, |
| 30 | musl, |
| 31 | ), |
| 32 | ).toMatchObject({ |
| 33 | version: "1.5.7", |
| 34 | format: platform === "win32" ? "executable" : "tar.gz", |
| 35 | executable: { name: platform === "win32" ? "agy.exe" : "antigravity" }, |
| 36 | }); |
| 37 | }); |
| 38 | |
| 39 | it.each([ |
| 40 | { sha512: "invalid" }, |
| 41 | { url: manifest.url.replace("https:", "http:") }, |
| 42 | { url: manifest.url.replace("storage.googleapis.com", "storage.googleapis.com.evil.test") }, |
| 43 | { url: manifest.url.replace("antigravity-public", "another-bucket") }, |
| 44 | { url: manifest.url.replace("darwin-arm", "linux-arm") }, |
| 45 | { url: `${manifest.url}?redirect=elsewhere` }, |
| 46 | { url: manifest.url.replace("1.5.7-123", "1.5.6-123") }, |
| 47 | ])("rejects invalid or mismatched release metadata: %j", (change) => { |
| 48 | expect(parseAntigravityCliRelease({ ...manifest, ...change }, "darwin", "arm64")).toBeNull(); |
| 49 | }); |
| 50 | }); |