fix(tabs-a11y): mock config_schema on adapter response
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) <noreply@anthropic.com>
This commit is contained in:
parent
00265d7028
commit
998cd03265
@ -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([]);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user