Files
proxycast/electron/codexSettingsImport.test.ts
coso d3f25cbd24 chore: release 1.177.0
Land the TUI side-conversation snapshot pane and macOS default-microphone voice dictation, align remaining command coverage, and include the pending workspace changes for release validation.
2026-11-14 13:00:11 +08:00

33 lines
1.2 KiB
TypeScript

import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { readCodexSettings } from "./codexSettingsImport";
let root = "";
afterEach(async () => {
if (root) await rm(root, { recursive: true, force: true });
});
describe("readCodexSettings", () => {
it("reads approval, sandbox, and project keys", async () => {
root = await mkdtemp(path.join(tmpdir(), "lime-codex-settings-"));
await mkdir(path.join(root, ".codex"), { recursive: true });
await writeFile(
path.join(root, ".codex", "config.toml"),
'approval_policy = "on-request"\nsandbox_mode = "workspace-write"\n\n[projects."/repo/a"]\ntrust_level = "trusted"\n',
"utf8",
);
await expect(readCodexSettings({ home: root })).resolves.toEqual({
approvalPolicy: "on-request",
sandboxMode: "workspace-write",
projects: ["/repo/a"],
});
});
it("returns null without a Codex config", async () => {
root = await mkdtemp(path.join(tmpdir(), "lime-codex-missing-"));
await expect(readCodexSettings({ home: root })).resolves.toBeNull();
});
});