fix tests

This commit is contained in:
Kevin Alwell
2025-04-29 12:10:54 -04:00
parent d28aedb07b
commit 8e80716169
2 changed files with 12 additions and 17 deletions

View File

@@ -58,7 +58,8 @@ describe.each([
await loop.run([
{
type: "message",
content: [{ type: "text", text: "hello" }],
role: "user",
content: [{ type: "input_text", text: "hello" }],
},
]);
@@ -69,23 +70,17 @@ describe.each([
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* */
expect(payload).toHaveProperty("previous_response_id");
if (payload.input) {
// first user message is usually non-stored; assistant messages will be stored
// so here we just assert the property is not forcibly set to false
payload.input.forEach((m: any) => {
if ("store" in m) {
expect(m.store).not.toBe(false);
}
});
}
payload.input?.forEach((m: any) => {
if ("store" in m) {
expect(m.store).not.toBe(false);
}
});
}
});
});

View File

@@ -3,7 +3,7 @@
*/
import { describe, it, expect, beforeAll, afterAll } from "vitest";
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { mkdtempSync, rmSync, writeFileSync, mkdirSync } from "node:fs";
import { join } from "node:path";
import { tmpdir } from "node:os";
@@ -17,7 +17,7 @@ describe("disableResponseStorage persistence", () => {
beforeAll(() => {
// mkdir -p ~/.codex inside the sandbox
rmSync(codexDir, { recursive: true, force: true });
require("fs").mkdirSync(codexDir, { recursive: true });
mkdirSync(codexDir, { recursive: true });
// seed YAML with ZDR enabled
writeFileSync(yamlPath, "model: o4-mini\ndisableResponseStorage: true\n");