From 998cd032659ab0c6d8c091b45d5941de05c347b3 Mon Sep 17 00:00:00 2001 From: rabbitblood Date: Fri, 24 Apr 2026 12:04:51 -0700 Subject: [PATCH] fix(tabs-a11y): mock config_schema on adapter response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Schema-driven ChannelsTab renders no inputs when config_schema is absent — the test's bare {type, display_name} mock mismatched the real API shape and every getByLabelText("Bot Token") failed. Mock now mirrors GET /channels/adapters with the Telegram schema (bot_token password + chat_id text) so the a11y assertions run against the actual rendered form. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../components/__tests__/tabs.a11y.test.tsx | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/canvas/src/components/__tests__/tabs.a11y.test.tsx b/canvas/src/components/__tests__/tabs.a11y.test.tsx index 91f2c370..a7000917 100644 --- a/canvas/src/components/__tests__/tabs.a11y.test.tsx +++ b/canvas/src/components/__tests__/tabs.a11y.test.tsx @@ -183,7 +183,31 @@ describe("ChannelsTab — htmlFor/id label associations (WCAG 1.3.1)", () => { beforeEach(() => { mockApiGet.mockImplementation((url: string) => { if (url.includes("/channels/adapters")) { - return Promise.resolve([{ type: "telegram", display_name: "Telegram" }]); + // Mirror the real GET /channels/adapters shape — schema-driven form + // relies on config_schema arriving from the adapter. A bare + // {type, display_name} mock renders an empty form and every + // getByLabelText below fails. + return Promise.resolve([ + { + type: "telegram", + display_name: "Telegram", + config_schema: [ + { + key: "bot_token", + label: "Bot Token", + type: "password", + required: true, + sensitive: true, + }, + { + key: "chat_id", + label: "Chat IDs", + type: "text", + required: true, + }, + ], + }, + ]); } return Promise.resolve([]); });