| 1 | import assert from "node:assert/strict"; |
| 2 | import test from "node:test"; |
| 3 | import { platformPackage, renderHomebrewCask, targets } from "./build-release-cli-candidate.mjs"; |
| 4 | |
| 5 | test("platform package embeds the immutable full candidate identity", () => { |
| 6 | const pkg = platformPackage(targets[0], "1.2.3", "a".repeat(40)); |
| 7 | assert.equal(pkg.name, "@reasonix/cli-darwin-arm64"); |
| 8 | assert.equal(pkg.reasonixCandidateSha, "a".repeat(40)); |
| 9 | assert.equal(pkg.gitHead, "a".repeat(40)); |
| 10 | }); |
| 11 | |
| 12 | test("homebrew cask is checksum-bound to prepared CLI archives", () => { |
| 13 | const sums = Object.fromEntries(targets.filter(target => target.goos !== "windows").map(target => [`reasonix-${target.key}.tar.gz`, target.key.includes("arm64") ? "a".repeat(64) : "b".repeat(64)])); |
| 14 | const cask = renderHomebrewCask("1.2.3", sums); |
| 15 | assert.match(cask, /version "1\.2\.3"/); |
| 16 | assert.match(cask, /sha256 "a{64}"/); |
| 17 | assert.match(cask, /releases\/download\/v#\{version\}/); |
| 18 | }); |
| 19 |