You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cover the AI chat, tools and tree actions, then raise coverage thresholds #58
Follow-up to #57. After #57, thresholds still sit right at the current coverage, and four files hold most of the untested logic. Numbers are from master after #56:
File
Stmts
Branch
Funcs
What is not tested
src/editor/Main/Chat/ChatPanel.tsx
70.24
75.67
51.61
Confirming a tool action (approve, decline, Stop while the confirm is open), Stop, Clear, Enter vs Shift+Enter, changing settings (provider/model/key), timeout error text
src/ai/tools.ts
79.1
69.36
80
create_element, update_element, delete_element (lines 534–589): success, "not found", user declines; plus single uncovered branches at 197–344, 457–516
src/editor/Main/TemplateTree/TemplateTree.tsx
87.5
64.28
85.71
Add node when the picked element no longer exists (86–89), cancel of the add/edit modals (115, 119)
src/ai/providers.ts
75
66.66
75
fetchWithTimeout (70–73): aborts after REQUEST_TIMEOUT_MS, keeps the caller's signal; createModel for each provider (Anthropic sends anthropic-dangerous-direct-browser-access)
These are the parts users touch most (the AI chat and its tools). A regression there passes CI today.
Proposal
One PR per row, so each stays small and reviewable. Each PR:
Adds the tests for that file. Mock the API with vi.mock("@/api/main", …), and for fetchWithTimeout use fake timers. No network.
Raises coverage.thresholds in vitest.config.mts to the new measured values, rounded down. No threshold goes down.
Acceptance criteria
ChatPanel.tsx: confirm, Stop, Clear, keyboard and settings flows tested
tools.ts: element tools tested, including "not found" and the declined deletion
TemplateTree.tsx: missing element and modal cancel tested
providers.ts: timeout and createModel tested
Final thresholds are at least functions 85 and branches 80, with npm run test:coverage green
Area
Tests (Vitest, coverage thresholds)
Out of scope
Changing behavior. If a test finds a bug, open a separate issue/PR for the fix.
E2E (Playwright) coverage.
Depends on #57 (merge it first so the threshold changes do not conflict).
Found while reviewing #55: AddElementForm loads the elements without error handling, so a failed request leaves the select empty with no message. It is a behavior fix, so per the scope of this issue it is tracked separately in #59. A test for it there also adds coverage for AddElementForm.tsx.
Activity
vadim9999 commentedon Nov 26, 2026
Found while reviewing #55:
AddElementFormloads the elements without error handling, so a failed request leaves the select empty with no message. It is a behavior fix, so per the scope of this issue it is tracked separately in #59. A test for it there also adds coverage forAddElementForm.tsx.