test(create): integration test for transforms without network

Made-with: Cursor
This commit is contained in:
zuiidea
2026-04-14 22:37:01 +08:00
parent 3579246c24
commit ca3cc71054
2 changed files with 31 additions and 0 deletions
@@ -0,0 +1,5 @@
{
"name": "template-placeholder",
"version": "0.0.0",
"private": true
}
@@ -0,0 +1,26 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
import { runTransforms } from "../transforms/run-transforms.js";
describe("create pipeline transforms", () => {
it("renames package.json", async () => {
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "cad-"));
const fixture = path.join(
path.dirname(fileURLToPath(import.meta.url)),
"../../fixtures/minimal-app"
);
fs.cpSync(fixture, tmp, { recursive: true });
await runTransforms({
projectRoot: tmp,
packageName: "my-fine-app",
skip: false,
});
const pkg = JSON.parse(
fs.readFileSync(path.join(tmp, "package.json"), "utf8")
);
expect(pkg.name).toBe("my-fine-app");
});
});