test: cover Find, ConnectionGeneralTab, and session-hook error paths#131
Merged
Conversation
Fills gaps surfaced while regression-testing the #127–#130 refactor: - e2e/query-editor-find.spec.ts: in-editor Find (Cmd+F) had no e2e coverage after the #128 QueryEditor/FindBar split — open/focus/close, match count, next/prev navigation, clear-resets. - ConnectionGeneralTab.test.tsx: the #129-extracted tab had no test (40% func) — field edits, port numeric coercion, password mask/reveal, isEdit placeholder, derived URL. - useDatasourceSession: GetCompletions failure during connect/refresh; disconnect no-op when nothing is connected. - useQueryHistory: null history result coerces to [].
Adds the missing hooks-branch tests and turns the flat #51 threshold into a two-tier gate: - useSidebarTree.test.ts (new): the hook had no direct test — covers the live-load error branches (columns/sub-folder load failures), the toggleColumnsFolder guard + toggle, and each sub-folder loader. - useQueryExecution: non-result-set (DDL) rows-affected path; error leaves a pinned tab intact; double-pin preserves the first; close a non-active tab. - useDatasourceSession: successful refresh clears a same-ds warning; a refresh for one ds leaves another ds's warning intact. hooks branch coverage 78.6% -> 82.7%; overall 89.8% -> 90.6% stmt. vitest.config.ts: global ratchet floor (90/82/90/91) as a regression gate, plus higher per-dir floors for pure logic (lib/ 97/90/100/99, hooks/ 95/82/95/97). Verified the glob thresholds are enforced.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fills test-coverage gaps surfaced while regression-testing the #127–#130 refactor, and replaces the flat issue-#51 coverage threshold with a two-tier gate. Tests + config only — no production code changed.
Tests added (28 unit + 4 e2e)
e2e/query-editor-find.spec.tsConnectionGeneralTab.test.tsxisEditplaceholder, derived URL.useSidebarTree.test.ts(new)toggleColumnsFolderguard + toggle, each sub-folder loader, close-without-reload.useQueryExecution.test.tsuseDatasourceSession.test.tsuseQueryHistory.test.tsnullcoerces to[].Coverage thresholds (two-tier)
Replaces the flat baseline threshold with:
lib/(97/90/100/99),hooks/(95/82/95/97). Verified the glob thresholds are actually enforced (negative test failed as expected).Numbers
ConnectionGeneralTab40%→100% func;useDatasourceSession95%→100% stmtTest plan
cd frontend && npm run test— 489 pass, thresholds enforcednpx playwright test— 95 passgo test ./...— passcd frontend && npm run build— cleanFollow-up (not in this PR)
Wiring Playwright V8 coverage into the reported number would credit the QueryEditor/App paths that are e2e-tested, and is the honest way to reflect their real coverage.