2026-01-15 04:50:11 +00:00
|
|
|
import fs from "node:fs";
|
2026-02-04 12:15:01 -04:00
|
|
|
import os from "node:os";
|
2026-01-15 04:50:11 +00:00
|
|
|
import path from "node:path";
|
2026-02-04 11:55:54 -04:00
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
|
import { installChromeExtension } from "./browser-cli-extension";
|
2026-01-15 06:17:56 +00:00
|
|
|
|
2026-01-15 04:50:11 +00:00
|
|
|
describe("browser extension install", () => {
|
2026-02-04 11:55:54 -04:00
|
|
|
it("installs bundled chrome extension into a state dir", async () => {
|
2026-02-04 12:15:01 -04:00
|
|
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-ext-state-"));
|
2026-01-15 04:50:11 +00:00
|
|
|
|
2026-02-04 12:15:01 -04:00
|
|
|
try {
|
|
|
|
|
const result = await installChromeExtension({ stateDir: tmp });
|
2026-01-15 04:50:11 +00:00
|
|
|
|
2026-02-04 12:15:01 -04:00
|
|
|
expect(result.path).toBe(path.join(tmp, "browser", "chrome-extension"));
|
|
|
|
|
expect(fs.existsSync(path.join(result.path, "manifest.json"))).toBe(true);
|
|
|
|
|
} finally {
|
|
|
|
|
fs.rmSync(tmp, { recursive: true, force: true });
|
|
|
|
|
}
|
2026-01-15 06:17:56 +00:00
|
|
|
});
|
2026-01-15 04:50:11 +00:00
|
|
|
});
|