Files
tutti/tools/scripts/desktop-release-candidate.test.mjs
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

81 lines
2.4 KiB
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
import {
buildReleaseApprovalDigest,
createReleaseCandidateManifest,
validateReleaseCandidateManifest
} from "../../apps/desktop/scripts/lib/releaseCandidate.mjs";
function createManifest() {
return createReleaseCandidateManifest({
candidateId: "v1.2.3-abcdef0-run42-1",
tag: "v1.2.3",
version: "1.2.3",
targetCommit: "abcdef0123456789abcdef0123456789abcdef01",
sourceRef: "release/1.2",
createdAt: "2026-08-17T00:00:00.000Z",
workflowRunUrl: "https://github.example/runs/42",
checksums: "hash Tutti.dmg\n",
generatedSummary: '{"tag":"v1.2.3"}\n'
});
}
test("stable candidate manifest binds the planned version, artifacts, and generated summary", () => {
const manifest = createManifest();
assert.equal(manifest.tag, "v1.2.3");
assert.equal(manifest.channel, "stable");
assert.equal(
validateReleaseCandidateManifest(manifest, {
tag: "v1.2.3",
targetCommit: "abcdef0123456789abcdef0123456789abcdef01",
checksums: "hash Tutti.dmg\n",
generatedSummary: '{"tag":"v1.2.3"}\n'
}),
manifest
);
assert.throws(
() =>
validateReleaseCandidateManifest(manifest, {
checksums: "different",
generatedSummary: '{"tag":"v1.2.3"}\n'
}),
/checksums digest/
);
});
test("approval digest changes when either reviewed notes or the candidate changes", () => {
const manifest = createManifest();
const approved = { summarySource: "human-reviewed", zh: { headline: "A" } };
const digest = buildReleaseApprovalDigest(manifest, approved);
assert.notEqual(
digest,
buildReleaseApprovalDigest(manifest, {
...approved,
zh: { headline: "B" }
})
);
assert.notEqual(
digest,
buildReleaseApprovalDigest({ ...manifest, candidateId: "other" }, approved)
);
});
test("stable candidate manifest requires an immutable full commit SHA", () => {
assert.throws(
() =>
createReleaseCandidateManifest({
candidateId: "v1.2.3-abcdef0-run42-1",
tag: "v1.2.3",
version: "1.2.3",
targetCommit: "main",
sourceRef: "main",
createdAt: "2026-08-17T00:00:00.000Z",
workflowRunUrl: "https://github.example/runs/42",
checksums: "hash Tutti.dmg\n",
generatedSummary: '{"tag":"v1.2.3"}\n'
}),
/full Git commit SHA/
);
});