mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-14 18:10:39 +09:00
73 lines
2.2 KiB
TypeScript
73 lines
2.2 KiB
TypeScript
|
|
import { describe, expect, it } from "vitest";
|
||
|
|
import {
|
||
|
|
mergeExecutionWorkspaceConfig,
|
||
|
|
readExecutionWorkspaceConfig,
|
||
|
|
} from "../services/execution-workspaces.ts";
|
||
|
|
|
||
|
|
describe("execution workspace config helpers", () => {
|
||
|
|
it("reads typed config from persisted metadata", () => {
|
||
|
|
expect(readExecutionWorkspaceConfig({
|
||
|
|
source: "project_primary",
|
||
|
|
config: {
|
||
|
|
provisionCommand: "bash ./scripts/provision-worktree.sh",
|
||
|
|
teardownCommand: "bash ./scripts/teardown-worktree.sh",
|
||
|
|
cleanupCommand: "pkill -f vite || true",
|
||
|
|
workspaceRuntime: {
|
||
|
|
services: [{ name: "web", command: "pnpm dev", port: 3100 }],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
})).toEqual({
|
||
|
|
provisionCommand: "bash ./scripts/provision-worktree.sh",
|
||
|
|
teardownCommand: "bash ./scripts/teardown-worktree.sh",
|
||
|
|
cleanupCommand: "pkill -f vite || true",
|
||
|
|
workspaceRuntime: {
|
||
|
|
services: [{ name: "web", command: "pnpm dev", port: 3100 }],
|
||
|
|
},
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
it("merges config patches without dropping unrelated metadata", () => {
|
||
|
|
expect(mergeExecutionWorkspaceConfig(
|
||
|
|
{
|
||
|
|
source: "project_primary",
|
||
|
|
createdByRuntime: false,
|
||
|
|
config: {
|
||
|
|
provisionCommand: "bash ./scripts/provision-worktree.sh",
|
||
|
|
cleanupCommand: "pkill -f vite || true",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
teardownCommand: "bash ./scripts/teardown-worktree.sh",
|
||
|
|
workspaceRuntime: {
|
||
|
|
services: [{ name: "web", command: "pnpm dev" }],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
)).toEqual({
|
||
|
|
source: "project_primary",
|
||
|
|
createdByRuntime: false,
|
||
|
|
config: {
|
||
|
|
provisionCommand: "bash ./scripts/provision-worktree.sh",
|
||
|
|
teardownCommand: "bash ./scripts/teardown-worktree.sh",
|
||
|
|
cleanupCommand: "pkill -f vite || true",
|
||
|
|
workspaceRuntime: {
|
||
|
|
services: [{ name: "web", command: "pnpm dev" }],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
it("clears the nested config block when requested", () => {
|
||
|
|
expect(mergeExecutionWorkspaceConfig(
|
||
|
|
{
|
||
|
|
source: "project_primary",
|
||
|
|
config: {
|
||
|
|
provisionCommand: "bash ./scripts/provision-worktree.sh",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
null,
|
||
|
|
)).toEqual({
|
||
|
|
source: "project_primary",
|
||
|
|
});
|
||
|
|
});
|
||
|
|
});
|