Skip to content

Commit c20d45e

Browse files
committed
test: tighten codex binding assertions
1 parent c1b59a9 commit c20d45e

5 files changed

Lines changed: 28 additions & 38 deletions

File tree

extensions/codex/src/app-server/auth-profile-runtime-contract.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ describe("Auth profile runtime contract - Codex app-server adapter", () => {
212212
await harness.completeTurn();
213213
await run;
214214

215-
await expect(readCodexAppServerBinding(sessionFile)).resolves.toMatchObject({
216-
authProfileId: AUTH_PROFILE_RUNTIME_CONTRACT.openAiCodexProfileId,
217-
});
215+
const binding = await readCodexAppServerBinding(sessionFile);
216+
expect(binding?.authProfileId).toBe(AUTH_PROFILE_RUNTIME_CONTRACT.openAiCodexProfileId);
218217
});
219218
});

extensions/codex/src/app-server/models.test.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,8 @@ describe("listCodexAppServerModels", () => {
192192
},
193193
});
194194

195-
await expect(listPromise).resolves.toMatchObject({
196-
models: [{ id: "gpt-5.4" }, { id: "gpt-5.2" }],
197-
});
195+
const list = await listPromise;
196+
expect(list.models.map((model) => model.id)).toEqual(["gpt-5.4", "gpt-5.2"]);
198197
harness.client.close();
199198
startSpy.mockRestore();
200199
});
@@ -237,11 +236,10 @@ describe("listCodexAppServerModels", () => {
237236
},
238237
});
239238

240-
await expect(listPromise).resolves.toMatchObject({
241-
models: [{ id: "gpt-5.4" }],
242-
nextCursor: "page-2",
243-
truncated: true,
244-
});
239+
const list = await listPromise;
240+
expect(list.models.map((model) => model.id)).toEqual(["gpt-5.4"]);
241+
expect(list.nextCursor).toBe("page-2");
242+
expect(list.truncated).toBe(true);
245243
harness.client.close();
246244
startSpy.mockRestore();
247245
});

extensions/codex/src/app-server/session-binding.test.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,13 @@ describe("codex app-server session binding", () => {
4848

4949
const binding = await readCodexAppServerBinding(sessionFile);
5050

51-
expect(binding).toMatchObject({
52-
schemaVersion: 1,
53-
threadId: "thread-123",
54-
sessionFile,
55-
cwd: tempDir,
56-
model: "gpt-5.4-codex",
57-
modelProvider: "openai",
58-
dynamicToolsFingerprint: "tools-v1",
59-
});
51+
expect(binding?.schemaVersion).toBe(1);
52+
expect(binding?.threadId).toBe("thread-123");
53+
expect(binding?.sessionFile).toBe(sessionFile);
54+
expect(binding?.cwd).toBe(tempDir);
55+
expect(binding?.model).toBe("gpt-5.4-codex");
56+
expect(binding?.modelProvider).toBe("openai");
57+
expect(binding?.dynamicToolsFingerprint).toBe("tools-v1");
6058
const bindingStat = await fs.stat(resolveCodexAppServerBindingPath(sessionFile));
6159
expect(bindingStat.isFile()).toBe(true);
6260
});
@@ -142,11 +140,9 @@ describe("codex app-server session binding", () => {
142140
const binding = await readCodexAppServerBinding(sessionFile, nativeAuthLookup);
143141

144142
expect(raw).not.toContain('"modelProvider": "openai"');
145-
expect(binding).toMatchObject({
146-
threadId: "thread-123",
147-
authProfileId: "work",
148-
model: "gpt-5.4-mini",
149-
});
143+
expect(binding?.threadId).toBe("thread-123");
144+
expect(binding?.authProfileId).toBe("work");
145+
expect(binding?.model).toBe("gpt-5.4-mini");
150146
expect(binding?.modelProvider).toBeUndefined();
151147
});
152148

extensions/codex/src/app-server/thread-lifecycle.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe("Codex app-server model provider selection", () => {
132132
},
133133
);
134134

135-
expect(request).toMatchObject({ modelProvider: "openai" });
135+
expect(request.modelProvider).toBe("openai");
136136
});
137137

138138
it("keeps public OpenAI modelProvider when no native Codex auth profile is selected", () => {
@@ -143,7 +143,7 @@ describe("Codex app-server model provider selection", () => {
143143
developerInstructions: "test instructions",
144144
});
145145

146-
expect(request).toMatchObject({ modelProvider: "openai" });
146+
expect(request.modelProvider).toBe("openai");
147147
});
148148
});
149149

extensions/codex/src/conversation-control.test.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ describe("codex conversation controls", () => {
5353
"Codex permissions set to default.",
5454
);
5555

56-
await expect(readCodexAppServerBinding(sessionFile)).resolves.toMatchObject({
57-
threadId: "thread-1",
58-
serviceTier: "priority",
59-
approvalPolicy: "on-request",
60-
sandbox: "workspace-write",
61-
});
56+
const binding = await readCodexAppServerBinding(sessionFile);
57+
expect(binding?.threadId).toBe("thread-1");
58+
expect(binding?.serviceTier).toBe("priority");
59+
expect(binding?.approvalPolicy).toBe("on-request");
60+
expect(binding?.sandbox).toBe("workspace-write");
6261
});
6362

6463
it("does not persist public OpenAI provider after model changes on native auth bindings", async () => {
@@ -95,11 +94,9 @@ describe("codex conversation controls", () => {
9594
const raw = await fs.readFile(`${sessionFile}.codex-app-server.json`, "utf8");
9695
const binding = await readCodexAppServerBinding(sessionFile);
9796
expect(raw).not.toContain('"modelProvider": "openai"');
98-
expect(binding).toMatchObject({
99-
threadId: "thread-1",
100-
authProfileId: "work",
101-
model: "gpt-5.5",
102-
});
97+
expect(binding?.threadId).toBe("thread-1");
98+
expect(binding?.authProfileId).toBe("work");
99+
expect(binding?.model).toBe("gpt-5.5");
103100
expect(binding?.modelProvider).toBeUndefined();
104101
});
105102

0 commit comments

Comments
 (0)