2026-01-15 04:50:11 +00:00
|
|
|
import fs from "node:fs";
|
|
|
|
|
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-02-04 11:55:54 -04:00
|
|
|
// This test ensures the bundled extension path resolution matches the npm package layout.
|
|
|
|
|
// The install command should succeed without requiring any external symlinks.
|
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 () => {
|
|
|
|
|
const tmp = path.join(process.cwd(), ".tmp-test-openclaw-state", String(Date.now()));
|
2026-01-15 04:50:11 +00:00
|
|
|
|
2026-02-04 11:55:54 -04:00
|
|
|
const result = await installChromeExtension({ stateDir: tmp });
|
2026-01-15 04:50:11 +00:00
|
|
|
|
2026-02-04 11:55:54 -04:00
|
|
|
expect(result.path).toContain(path.join("browser", "chrome-extension"));
|
2026-01-15 04:50:11 +00:00
|
|
|
expect(fs.existsSync(path.join(result.path, "manifest.json"))).toBe(true);
|
2026-01-15 06:17:56 +00:00
|
|
|
});
|
2026-01-15 04:50:11 +00:00
|
|
|
});
|