mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
* chore: enforce test directory conventions Move package, app, and tool tests out of src and add guard enforcement so source directories stay source-only. * ci: use guard and package-scoped tests Run the new repository guard in CI and keep test execution aligned with package-scoped commands after removing root aliases. * ci: align stable release guard check Use the new repository guard in stable release verification after replacing the residual-JS-only script. * chore: tighten test layout enforcement Enforce sibling tests directories, typecheck moved test suites with dedicated configs, and refresh remaining guidance that pointed at src-based tests. * chore: clarify no-emit test tsconfigs Explicitly disable declaration-only emit in test tsconfigs so review tooling sees they are no-emit typecheck configs.
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { mkdtemp, readFile, rm, writeFile, mkdir } from "node:fs/promises";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
|
|
import { copyBundledResourceTrees } from "../src/resources.js";
|
|
|
|
describe("copyBundledResourceTrees", () => {
|
|
it("includes prompt templates", async () => {
|
|
const root = await mkdtemp(join(tmpdir(), "open-design-tools-pack-"));
|
|
const workspaceRoot = join(root, "workspace");
|
|
const resourceRoot = join(root, "resources");
|
|
|
|
try {
|
|
const promptTemplatePath = join(
|
|
workspaceRoot,
|
|
"prompt-templates",
|
|
"image",
|
|
"sample.json",
|
|
);
|
|
const communityPetPath = join(
|
|
workspaceRoot,
|
|
"assets",
|
|
"community-pets",
|
|
"sample",
|
|
"pet.json",
|
|
);
|
|
await mkdir(join(workspaceRoot, "skills", "sample"), { recursive: true });
|
|
await mkdir(join(workspaceRoot, "design-systems", "sample"), {
|
|
recursive: true,
|
|
});
|
|
await mkdir(join(workspaceRoot, "craft", "sample"), { recursive: true });
|
|
await mkdir(join(workspaceRoot, "assets", "frames"), { recursive: true });
|
|
await mkdir(join(workspaceRoot, "assets", "community-pets", "sample"), {
|
|
recursive: true,
|
|
});
|
|
await mkdir(join(workspaceRoot, "prompt-templates", "image"), {
|
|
recursive: true,
|
|
});
|
|
await writeFile(promptTemplatePath, "{\"id\":\"sample\"}\n", "utf8");
|
|
await writeFile(communityPetPath, "{\"name\":\"sample\"}\n", "utf8");
|
|
|
|
await copyBundledResourceTrees({ workspaceRoot, resourceRoot });
|
|
|
|
await expect(
|
|
readFile(
|
|
join(resourceRoot, "prompt-templates", "image", "sample.json"),
|
|
"utf8",
|
|
),
|
|
).resolves.toBe("{\"id\":\"sample\"}\n");
|
|
await expect(
|
|
readFile(
|
|
join(resourceRoot, "community-pets", "sample", "pet.json"),
|
|
"utf8",
|
|
),
|
|
).resolves.toBe("{\"name\":\"sample\"}\n");
|
|
} finally {
|
|
await rm(root, { force: true, recursive: true });
|
|
}
|
|
});
|
|
});
|