Skip to content

Commit 2ec8036

Browse files
committed
test: update integration harness for deploy cleanup
1 parent 855126b commit 2ec8036

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

cli-integration.test.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ after(async () => {
118118
(process as { exit: (code?: number) => never }).exit = originalExit;
119119
delete process.env.RUN402_CONFIG_DIR;
120120
delete process.env.RUN402_API_BASE;
121-
rmSync(tempDir, { recursive: true, force: true });
121+
if (tempDir) rmSync(tempDir, { recursive: true, force: true });
122122
});
123123

124124
beforeEach(() => {
@@ -399,7 +399,7 @@ describe("CLI integration (live API, no mocks)", { timeout: 180_000 }, () => {
399399
it("subdomains list", async () => {
400400
const { run } = await import("./cli/lib/subdomains.mjs");
401401
captureStart();
402-
await run("list", [projectId]);
402+
await run("list", ["--project", projectId]);
403403
captureStop();
404404
assert.ok(captured().includes(subdomainName), "should list the subdomain");
405405
});
@@ -554,19 +554,25 @@ describe("CLI integration (live API, no mocks)", { timeout: 180_000 }, () => {
554554
});
555555

556556
it("mpp: deploy site", async () => {
557-
const { run } = await import("./cli/lib/deploy.mjs");
557+
const { runDeployV2 } = await import("./cli/lib/deploy-v2.mjs");
558558
const manifestPath = join(tempDir, "mpp-manifest.json");
559559
writeFileSync(
560560
manifestPath,
561561
JSON.stringify({
562-
files: [{ file: "index.html", data: "<!DOCTYPE html><html><body><h1>MPP Test App</h1></body></html>" }],
562+
site: {
563+
replace: {
564+
"index.html": "<!DOCTYPE html><html><body><h1>MPP Test App</h1></body></html>",
565+
},
566+
},
563567
}),
564568
);
565569
captureStart();
566-
await run(["--manifest", manifestPath, "--project", mppProjectId]);
570+
await runDeployV2("apply", ["--manifest", manifestPath, "--project", mppProjectId, "--quiet"]);
567571
captureStop();
568572
const out = captured();
569-
assert.ok(out.includes(mppProjectId) || out.includes("sites.run402.com"), `Expected deploy result in: ${out}`);
573+
const data = capturedJson();
574+
assert.equal(data.status, "ok");
575+
assert.ok(data.release_id || out.includes("sites.run402.com"), `Expected deploy result in: ${out}`);
570576
});
571577

572578
it("mpp: projects delete", async () => {

mcp-integration.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ before(async () => {
4949
const { dirname } = await import("node:path");
5050
const thisDir = dirname(fileURLToPath(import.meta.url));
5151
const searchPaths = [
52+
join(thisDir, "..", "run402-private", ".env"),
5253
join(thisDir, "..", "run402", ".env"),
5354
join(thisDir, "..", "..", "dev", "run402", ".env"),
5455
];
@@ -61,7 +62,7 @@ before(async () => {
6162
}
6263
}
6364
if (!buyerKey) {
64-
throw new Error("BUYER_PRIVATE_KEY not found. Set env var or ensure ../run402/.env exists.");
65+
throw new Error("BUYER_PRIVATE_KEY not found. Set env var or ensure ../run402-private/.env exists.");
6566
}
6667

6768
tempDir = mkdtempSync(join(tmpdir(), "run402-mcp-integ-"));
@@ -92,7 +93,7 @@ before(async () => {
9293
after(() => {
9394
delete process.env.RUN402_CONFIG_DIR;
9495
delete process.env.RUN402_API_BASE;
95-
rmSync(tempDir, { recursive: true, force: true });
96+
if (tempDir) rmSync(tempDir, { recursive: true, force: true });
9697
});
9798

9899
// ─── Helper ──────────────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)