From c1ac243d0f291fbf58cd080bfa6814d40eb1d68a Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 9 May 2026 06:34:27 +0100 Subject: [PATCH] test: tighten codex registration callbacks --- extensions/codex/index.test.ts | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/extensions/codex/index.test.ts b/extensions/codex/index.test.ts index 68505805576..acd4e07734e 100644 --- a/extensions/codex/index.test.ts +++ b/extensions/codex/index.test.ts @@ -40,20 +40,33 @@ describe("codex plugin", () => { }), ); - expect(registerProvider.mock.calls[0]?.[0]).toMatchObject({ id: "codex", label: "Codex" }); - expect(registerAgentHarness.mock.calls[0]?.[0]).toMatchObject({ + const providerRegistration = registerProvider.mock.calls[0]?.[0] as Record; + const agentHarnessRegistration = registerAgentHarness.mock.calls[0]?.[0] as Record< + string, + unknown + >; + const mediaProviderRegistration = registerMediaUnderstandingProvider.mock.calls[0]?.[0] as + | Record + | undefined; + const inboundClaimRegistration = on.mock.calls[0] as [unknown, unknown] | undefined; + const bindingResolvedRegistration = onConversationBindingResolved.mock.calls[0] as + | [unknown] + | undefined; + + expect(providerRegistration).toMatchObject({ id: "codex", label: "Codex" }); + expect(agentHarnessRegistration).toMatchObject({ id: "codex", label: "Codex agent harness", deliveryDefaults: { sourceVisibleReplies: "message_tool" }, - dispose: expect.any(Function), }); - expect(registerMediaUnderstandingProvider.mock.calls[0]?.[0]).toMatchObject({ + expect(typeof agentHarnessRegistration.dispose).toBe("function"); + expect(mediaProviderRegistration).toMatchObject({ id: "codex", capabilities: ["image"], defaultModels: { image: "gpt-5.5" }, - describeImage: expect.any(Function), - describeImages: expect.any(Function), }); + expect(typeof mediaProviderRegistration?.describeImage).toBe("function"); + expect(typeof mediaProviderRegistration?.describeImages).toBe("function"); expect(registerCommand.mock.calls[0]?.[0]).toMatchObject({ name: "codex", description: "Inspect and control the Codex app-server harness", @@ -62,8 +75,9 @@ describe("codex plugin", () => { id: "codex", label: "Codex", }); - expect(on).toHaveBeenCalledWith("inbound_claim", expect.any(Function)); - expect(onConversationBindingResolved).toHaveBeenCalledWith(expect.any(Function)); + expect(inboundClaimRegistration?.[0]).toBe("inbound_claim"); + expect(typeof inboundClaimRegistration?.[1]).toBe("function"); + expect(typeof bindingResolvedRegistration?.[0]).toBe("function"); }); it("registers with capture APIs that do not expose conversation binding hooks yet", () => {