Files
clawhub/scripts/seed.test.ts
T
Patrick Erichsen 0fb07e5b99 feat: align skills.sh catalog presentation (#3370)
* feat: align skills.sh catalog presentation

* refactor: share skill detail shell with skills.sh

* test: seed skills.sh route fixtures locally

* refactor: share full skill detail page view

* feat: refine skills.sh detail presentation

* feat: refine skills.sh detail metadata

* fix: refine skills.sh detail spacing
2026-08-01 16:46:48 -07:00

90 lines
2.6 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { assertSeedTargetAllowed, buildSeedSteps, parseSeedArgs } from "./seed";
describe("shared seed runner", () => {
it("uses the local deployment selected by the environment by default", () => {
expect(buildSeedSteps(parseSeedArgs([]))).toEqual([
{
command: "bunx",
args: ["convex", "run", "--no-push", "devSeed:seedLocalFixtures"],
},
{
command: "bunx",
args: ["convex", "run", "--no-push", "devSeed:seedCanonicalSearchFixture"],
},
{
command: "bun",
args: ["scripts/public-corpus/seed-public-corpus.ts"],
},
{
command: "bun",
args: ["scripts/public-corpus/seed-catalog-presentation.ts"],
},
{
command: "bunx",
args: ["convex", "run", "--no-push", "statsMaintenance:updateGlobalStatsAction"],
},
]);
});
it("targets every seed step at the same named preview deployment", () => {
expect(buildSeedSteps(parseSeedArgs(["--preview-name", "feature/demo"]))).toEqual([
{
command: "bunx",
args: ["convex", "run", "--preview-name", "feature/demo", "devSeed:seedLocalFixtures"],
},
{
command: "bunx",
args: [
"convex",
"run",
"--preview-name",
"feature/demo",
"devSeed:seedCanonicalSearchFixture",
],
},
{
command: "bun",
args: ["scripts/public-corpus/seed-public-corpus.ts", "--preview-name", "feature/demo"],
},
{
command: "bun",
args: [
"scripts/public-corpus/seed-catalog-presentation.ts",
"--preview-name",
"feature/demo",
],
},
{
command: "bunx",
args: [
"convex",
"run",
"--preview-name",
"feature/demo",
"statsMaintenance:updateGlobalStatsAction",
],
},
]);
});
it("allows only local or explicitly keyed preview targets", () => {
expect(() =>
assertSeedTargetAllowed(parseSeedArgs([]), {
CONVEX_DEPLOYMENT: "local:local-amantus-clawdhub",
}),
).not.toThrow();
expect(() =>
assertSeedTargetAllowed(parseSeedArgs(["--preview-name", "feature/demo"]), {
CONVEX_DEPLOY_KEY: "preview:openclaw:clawhub|secret",
}),
).not.toThrow();
expect(() =>
assertSeedTargetAllowed(parseSeedArgs(["--preview-name", "feature/demo"]), {
CONVEX_DEPLOY_KEY: "prod:wry-manatee-359|secret",
}),
).toThrow("requires a Convex Preview deploy key");
});
});