mirror of
https://github.com/openai/codex.git
synced 2026-04-28 02:11:08 +03:00
fix typecheck error
This commit is contained in:
@@ -64,15 +64,19 @@ describe.each([
|
||||
|
||||
expect(createSpy).toHaveBeenCalledTimes(1);
|
||||
|
||||
const payload: any = createSpy.mock.calls[0][0];
|
||||
const call = createSpy.mock.calls[0];
|
||||
if (!call) {
|
||||
throw new Error("Expected createSpy to have been called at least once");
|
||||
}
|
||||
const payload: any = call[0];
|
||||
|
||||
if (flag) {
|
||||
/* behaviour when ZDR is *on* */
|
||||
expect(payload).not.toHaveProperty("previous_response_id");
|
||||
if (payload.input) {
|
||||
payload.input.forEach((m: any) =>
|
||||
expect(m.store === undefined ? false : m.store).toBe(false),
|
||||
);
|
||||
payload.input.forEach((m: any) => {
|
||||
expect(m.store === undefined ? false : m.store).toBe(false);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
/* behaviour when ZDR is *off* */
|
||||
|
||||
@@ -8,13 +8,14 @@ import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
|
||||
import { loadConfig, saveConfig } from "../src/utils/config";
|
||||
import type { AppConfig } from "../src/utils/config";
|
||||
|
||||
const sandboxHome = mkdtempSync(join(tmpdir(), "codex-home-"));
|
||||
const codexDir = join(sandboxHome, ".codex");
|
||||
const yamlPath = join(codexDir, "config.yaml");
|
||||
const sandboxHome: string = mkdtempSync(join(tmpdir(), "codex-home-"));
|
||||
const codexDir: string = join(sandboxHome, ".codex");
|
||||
const yamlPath: string = join(codexDir, "config.yaml");
|
||||
|
||||
describe("disableResponseStorage persistence", () => {
|
||||
beforeAll(() => {
|
||||
beforeAll((): void => {
|
||||
// mkdir -p ~/.codex inside the sandbox
|
||||
rmSync(codexDir, { recursive: true, force: true });
|
||||
mkdirSync(codexDir, { recursive: true });
|
||||
@@ -23,20 +24,20 @@ describe("disableResponseStorage persistence", () => {
|
||||
writeFileSync(yamlPath, "model: o4-mini\ndisableResponseStorage: true\n");
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
afterAll((): void => {
|
||||
rmSync(sandboxHome, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("keeps disableResponseStorage=true across load/save cycle", async () => {
|
||||
it("keeps disableResponseStorage=true across load/save cycle", async (): Promise<void> => {
|
||||
// 1️⃣ explicitly load the sandbox file
|
||||
const cfg1 = loadConfig(yamlPath);
|
||||
const cfg1: AppConfig = loadConfig(yamlPath);
|
||||
expect(cfg1.disableResponseStorage).toBe(true);
|
||||
|
||||
// 2️⃣ save right back to the same file
|
||||
await saveConfig(cfg1, yamlPath);
|
||||
|
||||
// 3️⃣ reload and re-assert
|
||||
const cfg2 = loadConfig(yamlPath);
|
||||
const cfg2: AppConfig = loadConfig(yamlPath);
|
||||
expect(cfg2.disableResponseStorage).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user