mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:10:45 +00:00
ci: add package acceptance workflow
This commit is contained in:
51
test/scripts/resolve-openclaw-package-candidate.test.ts
Normal file
51
test/scripts/resolve-openclaw-package-candidate.test.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
parseArgs,
|
||||
validateOpenClawPackageSpec,
|
||||
} from "../../scripts/resolve-openclaw-package-candidate.mjs";
|
||||
|
||||
describe("resolve-openclaw-package-candidate", () => {
|
||||
it("accepts only OpenClaw release package specs for npm candidates", () => {
|
||||
expect(() => validateOpenClawPackageSpec("openclaw@beta")).not.toThrow();
|
||||
expect(() => validateOpenClawPackageSpec("openclaw@latest")).not.toThrow();
|
||||
expect(() => validateOpenClawPackageSpec("openclaw@2026.4.27")).not.toThrow();
|
||||
expect(() => validateOpenClawPackageSpec("openclaw@2026.4.27-1")).not.toThrow();
|
||||
expect(() => validateOpenClawPackageSpec("openclaw@2026.4.27-beta.2")).not.toThrow();
|
||||
|
||||
expect(() => validateOpenClawPackageSpec("@evil/openclaw@1.0.0")).toThrow(
|
||||
"package_spec must be openclaw@beta",
|
||||
);
|
||||
expect(() => validateOpenClawPackageSpec("openclaw@canary")).toThrow(
|
||||
"package_spec must be openclaw@beta",
|
||||
);
|
||||
expect(() => validateOpenClawPackageSpec("openclaw@2026.04.27")).toThrow(
|
||||
"package_spec must be openclaw@beta",
|
||||
);
|
||||
});
|
||||
|
||||
it("parses optional empty workflow inputs without rejecting the command line", () => {
|
||||
expect(
|
||||
parseArgs([
|
||||
"--source",
|
||||
"npm",
|
||||
"--package-spec",
|
||||
"openclaw@beta",
|
||||
"--package-url",
|
||||
"",
|
||||
"--package-sha256",
|
||||
"",
|
||||
"--artifact-dir",
|
||||
".",
|
||||
"--output-dir",
|
||||
".artifacts/docker-e2e-package",
|
||||
]),
|
||||
).toMatchObject({
|
||||
artifactDir: ".",
|
||||
outputDir: ".artifacts/docker-e2e-package",
|
||||
packageSha256: "",
|
||||
packageSpec: "openclaw@beta",
|
||||
packageUrl: "",
|
||||
source: "npm",
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user