mirror of https://github.com/openclaw/openclaw.git
25 lines
983 B
TypeScript
25 lines
983 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { normalizePackageTagInput } from "./package-tag.js";
|
|
|
|
describe("normalizePackageTagInput", () => {
|
|
const packageNames = ["openclaw", "@openclaw/plugin"] as const;
|
|
|
|
it.each([
|
|
{ input: undefined, expected: null },
|
|
{ input: " ", expected: null },
|
|
{ input: "openclaw@beta", expected: "beta" },
|
|
{ input: "@openclaw/plugin@2026.2.24", expected: "2026.2.24" },
|
|
{ input: "openclaw@ ", expected: null },
|
|
{ input: "openclaw", expected: null },
|
|
{ input: " @openclaw/plugin ", expected: null },
|
|
{ input: " latest ", expected: "latest" },
|
|
{ input: "@other/plugin@beta", expected: "@other/plugin@beta" },
|
|
{ input: "openclawer@beta", expected: "openclawer@beta" },
|
|
] satisfies ReadonlyArray<{ input: string | undefined; expected: string | null }>)(
|
|
"normalizes %j",
|
|
({ input, expected }) => {
|
|
expect(normalizePackageTagInput(input, packageNames)).toBe(expected);
|
|
},
|
|
);
|
|
});
|