chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -4,27 +4,19 @@ import path from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
resolveControlUiDistIndexPath,
|
||||
resolveControlUiRepoRoot,
|
||||
} from "./control-ui-assets.js";
|
||||
import { resolveControlUiDistIndexPath, resolveControlUiRepoRoot } from "./control-ui-assets.js";
|
||||
|
||||
describe("control UI assets helpers", () => {
|
||||
it("resolves repo root from src argv1", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-ui-"));
|
||||
try {
|
||||
await fs.mkdir(path.join(tmp, "ui"), { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(tmp, "ui", "vite.config.ts"),
|
||||
"export {};\n",
|
||||
);
|
||||
await fs.writeFile(path.join(tmp, "ui", "vite.config.ts"), "export {};\n");
|
||||
await fs.writeFile(path.join(tmp, "package.json"), "{}\n");
|
||||
await fs.mkdir(path.join(tmp, "src"), { recursive: true });
|
||||
await fs.writeFile(path.join(tmp, "src", "index.ts"), "export {};\n");
|
||||
|
||||
expect(resolveControlUiRepoRoot(path.join(tmp, "src", "index.ts"))).toBe(
|
||||
tmp,
|
||||
);
|
||||
expect(resolveControlUiRepoRoot(path.join(tmp, "src", "index.ts"))).toBe(tmp);
|
||||
} finally {
|
||||
await fs.rm(tmp, { recursive: true, force: true });
|
||||
}
|
||||
@@ -34,17 +26,12 @@ describe("control UI assets helpers", () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-ui-"));
|
||||
try {
|
||||
await fs.mkdir(path.join(tmp, "ui"), { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(tmp, "ui", "vite.config.ts"),
|
||||
"export {};\n",
|
||||
);
|
||||
await fs.writeFile(path.join(tmp, "ui", "vite.config.ts"), "export {};\n");
|
||||
await fs.writeFile(path.join(tmp, "package.json"), "{}\n");
|
||||
await fs.mkdir(path.join(tmp, "dist"), { recursive: true });
|
||||
await fs.writeFile(path.join(tmp, "dist", "index.js"), "export {};\n");
|
||||
|
||||
expect(resolveControlUiRepoRoot(path.join(tmp, "dist", "index.js"))).toBe(
|
||||
tmp,
|
||||
);
|
||||
expect(resolveControlUiRepoRoot(path.join(tmp, "dist", "index.js"))).toBe(tmp);
|
||||
} finally {
|
||||
await fs.rm(tmp, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user