test: expand component test coverage - #34
Merged
Merged
Conversation
Adds happy-dom environment, vitest.config.ts (using bare svelte() plugin to avoid SSR mode), a global setup file that mocks Tauri IPC and registers cleanup, and 19 Dropdown tests covering rendering, keyboard nav, and ARIA. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Svelte 5 requires bind:this on array indices to use a $state array so the binding can be tracked reactively. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Installs @vitest/coverage-v8, adds coverage section to vitest.config.ts scoped to src/lib, and ignores the generated /coverage directory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- TrackRow: rendering, track number vs play icon, playing class, onclick - StarRating: display for null/whole/half/full ratings, readonly mode, full-star and half-star click, toggle-off on current rating - ui store: tests factory via exported createUiStore for isolation; covers initial state and all mutual-exclusivity constraints between settings, device sync, and the now-playing drawer Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a Testing section to CLAUDE.md covering: what to test and in what priority order, what to skip, mocking rules, and the framework stack. The guiding principle: coverage reports show gaps, not correctness. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…, and connected components - Update vitest.setup.ts to mock $lib/api/commands with per-command sensible defaults so stores that fetch on init (player, theme) work correctly in tests; add convertFileSrc mock for art-path components - Extract normalize() and matchScore() from ArtistList.svelte into src/lib/search.ts so they are independently testable; add 16 tests - Extract sortAlbums() from AlbumGrid.svelte into src/lib/sort.ts so the three sort modes are independently testable; add 12 tests - Fix binding_property_non_reactive warning in ThemeSwitcher.svelte (optionElements array was not reactive, same fix already applied to Dropdown.svelte); add 20 keyboard-navigation and interaction tests - Add component tests for TransportBar (stopped/playing rendering, disabled states, control click handlers), AlbumGrid (empty-state prompt, loading state, Settings link), TrackTable (back button), and NowPlayingDrawer (dialog rendering, focus management, Escape and backdrop close) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
TypeScript now resolves the NodeJS process global from type definitions, so the suppression directive is unused and fails svelte-check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lstebner
force-pushed
the
test/expand-component-coverage
branch
from
July 11, 2026 03:55
fc63b4b to
9259720
Compare
Closed
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.
Summary
normalize()/matchScore()fromArtistList.svelteintosrc/lib/search.tsandsortAlbums()fromAlbumGrid.svelteintosrc/lib/sort.tsso that logic is independently testablebinding_property_non_reactiveSvelte warning inThemeSwitcher.svelte(optionElementswas not$state, same bug already fixed inDropdown.svelte)vitest.setup.tsto mock$lib/api/commandswith per-command sensible defaults (stopped snapshot, empty EQ gains, etc.) and adds aconvertFileSrcmock — this unblocks tests for any component that imports a store which calls commands on initsearch,sort,ThemeSwitcher,TransportBar,AlbumGrid,TrackTable, andNowPlayingDrawer(129 tests total across 12 files, all passing)Connected component tests use
vi.hoisted()to create shared mock state objects thatvi.mock()factories capture by reference, letting individual tests repoint the snapshot or toggle flags before each render without hitting the module-singleton problem.Test plan
npm run test— all 129 tests passnpm run check— no new type errors (one pre-existing unused@ts-expect-errorinvite.config.jsunrelated to this PR)🤖 Generated with Claude Code