mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-18 07:57:29 +00:00
perf(test): use tiny fixture for browser extension install test
This commit is contained in:
@@ -65,11 +65,16 @@ describe("browser extension install", () => {
|
||||
|
||||
try {
|
||||
const { installChromeExtension } = await import("./browser-cli-extension.js");
|
||||
const sourceDir = path.resolve(process.cwd(), "assets/chrome-extension");
|
||||
// Keep this test hermetic + fast: use a tiny fixture instead of copying the
|
||||
// full repo assets tree.
|
||||
const sourceDir = path.join(tmp, "source-ext");
|
||||
writeManifest(sourceDir);
|
||||
fs.writeFileSync(path.join(sourceDir, "test.txt"), "ok");
|
||||
const result = await installChromeExtension({ stateDir: tmp, sourceDir });
|
||||
|
||||
expect(result.path).toBe(path.join(tmp, "browser", "chrome-extension"));
|
||||
expect(fs.existsSync(path.join(result.path, "manifest.json"))).toBe(true);
|
||||
expect(fs.existsSync(path.join(result.path, "test.txt"))).toBe(true);
|
||||
expect(result.path.includes("node_modules")).toBe(false);
|
||||
} finally {
|
||||
fs.rmSync(tmp, { recursive: true, force: true });
|
||||
|
||||
Reference in New Issue
Block a user