Skip to content

test(web): cover the components, mix report, hotkeys and form drafts - #427

Merged
botandbang merged 11 commits into
mainfrom
bnb/web-components-coverage
Nov 5, 2026
Merged

botandbang merged 11 commits into
mainfrom
bnb/web-components-coverage

Conversation

@botandbang

@botandbang botandbang commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Tests for the web app's components (src/lib/components), the mix modules (src/lib/mix), hotkeys.svelte.ts and form-draft.svelte.ts, which had 155 uncovered lines, 122 functions and 483 branches between them. No app code changes.

Added:

  • Browser tests (Vitest browser mode) for the forms and inputs, profile and table components, press kit and supports components, and the mix report and set player. Each test finds UI by role, label or text and checks what a person sees or what the form would post.
  • Stories for states that had none: pagination, DM settings with chat unreachable, email settings paused or unconfirmed, bug report errors, empty and offline shows, plain invites in space people, a verification with no name left, and the artist search error. They run through the Storybook test project with its accessibility check.
  • performer-facts.test.ts renders PerformerFacts with svelte/server, since public pages render it there and a route test already imports that build.
  • Test helpers in src/lib/testing: stubFormAction() for use:enhance forms, renderInForm() for field groups, and servePlaces() for /api/places.
  • A property test for the mix report's lane layout (fast-check, server project).
  • In tests/e2e/app.e2e.ts, the change request test now also revises the request and checks that, after a reload, the saved revision isn't offered back as unsent changes. That's ProjectForm dropping its draft on a successful save, which a component test can't reach because enhance only applies a success result with the router started.

Changed:

  • player-fixtures.ts gains stalled(), a recording that never loads.
  • Existing test files in the areas above gain cases; none of their existing tests changed.

Coverage, from pnpm test:coverage (the 91 files above, before and after): lines 93.69% to 99.92%, functions 93.34% to 99.95%, statements 93.55% to 99.88%, branches 76.14% to 89.18%. The whole app, merged with main (#423 and #436 landed first): lines 99.53%, functions 99.36%, statements 99.35%, branches 94.79%. The coverage gate is raised to match in the last commit, to 99.4/99.2/99.2/94.6.

What's still uncovered:

  • tools/Capture.svelte, tools/HotCues.svelte and GuideList.svelte, which the Tools page branches are changing.
  • Svelte's compiled ?? '' around template values and its value re-checks on constant options, which a mounted component never takes.
  • Code no test can reach: DjStats.svelte:16 and TempoChart.svelte:54 (derived values only read inside an {#if} that rules the branch out), GenreInput.svelte:69 (the input before hydration), ProjectForm.svelte:78 (covered by the e2e test above, which coverage doesn't count), and fallbacks in mix/source.ts:47,79, mix/schema.ts:161 and mix/report.ts:226 that their callers never reach.

How it was tested

pnpm test:coverage, pnpm check, pnpm lint and pnpm format:check in apps/web, and pnpm test:e2e --project chromium -g 'a DJ proposes a change'. Each new test was broken once (its expectation or its input) and failed. The e2e check fails when ProjectForm's formDraft.sent call is removed.

Checklist

  • Tests cover the change
  • For the website: Storybook stories cover any new UI states
  • The READMEs, docs/ and --help still say what the code does

- epk: access requests (sign in, see the kit, error, declined, granted), the editor's delete confirm, conflicts while publishing, kit lists with custom access and untitled drafts, and every EpkForm field posted
- supports: an artist's supports with sparse data, the artist page offline, and a story for the artist search error
- add stubFormAction(), a fetch stub that holds a use:enhance form's answer so the form's saving state can be checked
- place and near pickers, genre and handle inputs, claim, show and project forms, and the basics, performer and promoter fields, each checked by what the form would post
- hotkeys: the saved preference, blocked storage, editable targets, and every held or modified key
- form drafts, the bug report approval, and stories for pagination, DM and email settings states and bug report errors
- e2e: a revised change request isn't offered back as unsent changes after it saves
- add renderInForm() and servePlaces() test helpers
- DjStats and PerformerFacts with sparse profiles, BookingDetails with only a phone, ManageLink for staff
- follow, profile setup and channel topic saves, and the remove confirms in the people, verification and staff tables
- render PerformerFacts on the server, as public pages do, and add stories for empty shows, plain invites and a verification with no name left
- MixReport, MixTracklist, KeyWheel, MixTimeline and TempoChart, with sparse and ridden reports
- the set player stalling, closing, and crediting the set's artist for a track with none
- the Mixcloud and SoundCloud widget loaders, MixList, LinkedSet and DjSets, without network
- report helpers: lanes (with a property test), Camelot keys, ticks, tempo steps and handoffs
The tracklist's title is now a button named by its visible text, with the row's details beside it, so the mix report and set player tests find rows by those names and look for details in the row's list item.
@botandbang
botandbang requested a review from bnb as a code owner November 4, 2026 02:23
@github-actions github-actions Bot added web The Local Network website (apps/web) web: projects Project profiles, claims, and the DJ stats and sets on them web: mixes Mixes, their tracklists and mix reports web: epk Press kits and who can see them web: ui Shared components, design tokens, layout and the static pages tests Tests, fixtures and test harnesses tooling Repo config, lint and build tooling, and GitHub settings labels Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Coverage Report for apps/web

Status Category Percentage Covered / Total
🟢 Lines 99.53% (🎯 99%)
⬆️ +1.37 pp
10344 / 10392
🟢 Statements 99.35% (🎯 99%)
⬆️ +2.20 pp
15835 / 15937
🟢 Functions 99.36% (🎯 99%)
⬆️ +2.73 pp
4225 / 4252
🟢 Branches 94.81% (🎯 94%)
⬆️ +2.90 pp
7728 / 8151
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/web/src/lib/components/mix/player-fixtures.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
Generated in workflow #341 for commit 96e7b78 by the Vitest Coverage Report Action

Size

Compared with main. KiB are 1,024 bytes.

This pull request main Change
Client JavaScript 771.3 KiB 771.3 KiB 0 B (0%)
Client JavaScript, brotli 259.3 KiB 259.3 KiB 0 B (0%)
Client CSS 94.5 KiB 94.5 KiB 0 B (0%)
Client CSS, brotli 13.6 KiB 13.6 KiB 0 B (0%)

Parsing the whole report for every generated span took the property past the 5 s timeout under CI's coverage run.
bnb
bnb previously approved these changes Nov 4, 2026
bnb
bnb previously approved these changes Nov 4, 2026
@botandbang
botandbang added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit cdd63ea Nov 5, 2026
24 checks passed
@botandbang
botandbang deleted the bnb/web-components-coverage branch November 5, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests, fixtures and test harnesses tooling Repo config, lint and build tooling, and GitHub settings web: epk Press kits and who can see them web: mixes Mixes, their tracklists and mix reports web: projects Project profiles, claims, and the DJ stats and sets on them web: ui Shared components, design tokens, layout and the static pages web The Local Network website (apps/web)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants