diff --git a/scripts/e2e/lib/codex-app-server-fixture.mjs b/scripts/e2e/lib/codex-app-server-fixture.mjs index ff90494bafb6..89665c8cb406 100644 --- a/scripts/e2e/lib/codex-app-server-fixture.mjs +++ b/scripts/e2e/lib/codex-app-server-fixture.mjs @@ -24,6 +24,7 @@ export function createFakeThreadStartResponse({ params, sessionId, threadId, ver forkedFromId: null, preview: "", ephemeral: false, + projectId: params?.projectId ?? null, modelProvider: "openai", createdAt: now, updatedAt: now, diff --git a/test/scripts/codex-app-server-fixture.test.ts b/test/scripts/codex-app-server-fixture.test.ts new file mode 100644 index 000000000000..9e404d23aa37 --- /dev/null +++ b/test/scripts/codex-app-server-fixture.test.ts @@ -0,0 +1,18 @@ +import { describe, expect, it } from "vitest"; +import { createFakeThreadStartResponse } from "../../scripts/e2e/lib/codex-app-server-fixture.mjs"; + +describe("createFakeThreadStartResponse", () => { + it.each([ + { expected: null, params: {} }, + { expected: "project-1", params: { projectId: "project-1" } }, + ])("returns the protocol-required projectId as $expected", ({ expected, params }) => { + const response = createFakeThreadStartResponse({ + params, + sessionId: "session-1", + threadId: "thread-1", + version: "0.149.1", + }); + + expect(response.thread.projectId).toBe(expected); + }); +});