mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 15:47:28 +00:00
87 lines
2.2 KiB
TypeScript
87 lines
2.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
parseNpmViewFields,
|
|
parseReleaseVerifyBetaArgs,
|
|
} from "../../scripts/lib/release-beta-verifier.ts";
|
|
|
|
describe("parseReleaseVerifyBetaArgs", () => {
|
|
it("defaults beta verification to the matching tag and repo", () => {
|
|
expect(parseReleaseVerifyBetaArgs(["2026.5.10-beta.3"])).toEqual({
|
|
version: "2026.5.10-beta.3",
|
|
tag: "v2026.5.10-beta.3",
|
|
distTag: "beta",
|
|
repo: "openclaw/openclaw",
|
|
registry: "https://clawhub.ai",
|
|
skipPostpublish: false,
|
|
rerunFailedClawHub: false,
|
|
workflowRuns: {},
|
|
});
|
|
});
|
|
|
|
it("parses child run IDs and repair flags", () => {
|
|
expect(
|
|
parseReleaseVerifyBetaArgs([
|
|
"--",
|
|
"2026.5.10-beta.3",
|
|
"--openclaw-npm-run",
|
|
"11",
|
|
"--plugin-npm-run",
|
|
"22",
|
|
"--plugin-clawhub-run",
|
|
"33",
|
|
"--skip-postpublish",
|
|
"--rerun-failed-clawhub",
|
|
]),
|
|
).toEqual({
|
|
version: "2026.5.10-beta.3",
|
|
tag: "v2026.5.10-beta.3",
|
|
distTag: "beta",
|
|
repo: "openclaw/openclaw",
|
|
registry: "https://clawhub.ai",
|
|
skipPostpublish: true,
|
|
rerunFailedClawHub: true,
|
|
workflowRuns: {
|
|
openclawNpm: "11",
|
|
pluginNpm: "22",
|
|
pluginClawHub: "33",
|
|
},
|
|
});
|
|
});
|
|
});
|
|
|
|
describe("parseNpmViewFields", () => {
|
|
it("accepts keyed npm view JSON", () => {
|
|
expect(
|
|
parseNpmViewFields(
|
|
JSON.stringify({
|
|
version: "2026.5.10-beta.3",
|
|
"dist-tags.beta": "2026.5.10-beta.3",
|
|
"dist.integrity": "sha512-test",
|
|
}),
|
|
"beta",
|
|
),
|
|
).toEqual({
|
|
version: "2026.5.10-beta.3",
|
|
distTagVersion: "2026.5.10-beta.3",
|
|
integrity: "sha512-test",
|
|
});
|
|
});
|
|
|
|
it("accepts nested npm view JSON", () => {
|
|
expect(
|
|
parseNpmViewFields(
|
|
JSON.stringify({
|
|
version: "2026.5.10-beta.3",
|
|
"dist-tags": { beta: "2026.5.10-beta.3" },
|
|
dist: { integrity: "sha512-test" },
|
|
}),
|
|
"beta",
|
|
),
|
|
).toEqual({
|
|
version: "2026.5.10-beta.3",
|
|
distTagVersion: "2026.5.10-beta.3",
|
|
integrity: "sha512-test",
|
|
});
|
|
});
|
|
});
|