test: tighten codex binding assertions · openclaw/openclaw@c20d45e
steipete
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -212,8 +212,7 @@ describe("Auth profile runtime contract - Codex app-server adapter", () => {
|
212 | 212 | await harness.completeTurn(); |
213 | 213 | await run; |
214 | 214 | |
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); |
218 | 217 | }); |
219 | 218 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -192,9 +192,8 @@ describe("listCodexAppServerModels", () => {
|
192 | 192 | }, |
193 | 193 | }); |
194 | 194 | |
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"]); |
198 | 197 | harness.client.close(); |
199 | 198 | startSpy.mockRestore(); |
200 | 199 | }); |
@@ -237,11 +236,10 @@ describe("listCodexAppServerModels", () => {
|
237 | 236 | }, |
238 | 237 | }); |
239 | 238 | |
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); |
245 | 243 | harness.client.close(); |
246 | 244 | startSpy.mockRestore(); |
247 | 245 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -48,15 +48,13 @@ describe("codex app-server session binding", () => {
|
48 | 48 | |
49 | 49 | const binding = await readCodexAppServerBinding(sessionFile); |
50 | 50 | |
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"); |
60 | 58 | const bindingStat = await fs.stat(resolveCodexAppServerBindingPath(sessionFile)); |
61 | 59 | expect(bindingStat.isFile()).toBe(true); |
62 | 60 | }); |
@@ -142,11 +140,9 @@ describe("codex app-server session binding", () => {
|
142 | 140 | const binding = await readCodexAppServerBinding(sessionFile, nativeAuthLookup); |
143 | 141 | |
144 | 142 | 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"); |
150 | 146 | expect(binding?.modelProvider).toBeUndefined(); |
151 | 147 | }); |
152 | 148 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -132,7 +132,7 @@ describe("Codex app-server model provider selection", () => {
|
132 | 132 | }, |
133 | 133 | ); |
134 | 134 | |
135 | | -expect(request).toMatchObject({ modelProvider: "openai" }); |
| 135 | +expect(request.modelProvider).toBe("openai"); |
136 | 136 | }); |
137 | 137 | |
138 | 138 | it("keeps public OpenAI modelProvider when no native Codex auth profile is selected", () => { |
@@ -143,7 +143,7 @@ describe("Codex app-server model provider selection", () => {
|
143 | 143 | developerInstructions: "test instructions", |
144 | 144 | }); |
145 | 145 | |
146 | | -expect(request).toMatchObject({ modelProvider: "openai" }); |
| 146 | +expect(request.modelProvider).toBe("openai"); |
147 | 147 | }); |
148 | 148 | }); |
149 | 149 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -53,12 +53,11 @@ describe("codex conversation controls", () => {
|
53 | 53 | "Codex permissions set to default.", |
54 | 54 | ); |
55 | 55 | |
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"); |
62 | 61 | }); |
63 | 62 | |
64 | 63 | it("does not persist public OpenAI provider after model changes on native auth bindings", async () => { |
@@ -95,11 +94,9 @@ describe("codex conversation controls", () => {
|
95 | 94 | const raw = await fs.readFile(`${sessionFile}.codex-app-server.json`, "utf8"); |
96 | 95 | const binding = await readCodexAppServerBinding(sessionFile); |
97 | 96 | 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"); |
103 | 100 | expect(binding?.modelProvider).toBeUndefined(); |
104 | 101 | }); |
105 | 102 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。