perf(web): route-level code-splitting; harden channel config rendering

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwxdSt4reTm7Dj1oxRvpP3
This commit is contained in:
2026-07-04 16:04:17 +07:00
parent 41844d49a0
commit 8c35aed8f2
3 changed files with 43 additions and 25 deletions
+10
View File
@@ -48,6 +48,16 @@ test("отрисовывает список каналов без секрета
expect(screen.queryByDisplayValue(/123456/)).not.toBeInTheDocument()
})
test("formatConfig — вайтлист по типу канала не печатает незнакомые поля config", async () => {
vi.spyOn(api, "listChannels").mockResolvedValue([
{ id: "c5", type: "webhook", config: { url: "https://x", token: "LEAK" }, enabled: true },
])
renderPage()
expect(await screen.findByText(/url: https:\/\/x/)).toBeInTheDocument()
expect(document.body.textContent).not.toMatch(/LEAK/)
})
test("создание telegram-канала собирает config.chat_id + secret=bot_token", async () => {
const createSpy = vi.spyOn(api, "createChannel").mockResolvedValue({
id: "c3", type: "telegram", config: { chat_id: "999" }, enabled: true,