Skip to content

Finish frontend test backfill to 80% and make the coverage gate blocking #188

Description

@enko

Background

Follow-up to the code-quality foundation PR #186, which added the frontend test
infrastructure ($lib/test), the PR coverage report (danger-plugin-coverage,
report-only), and backfilled the entire API + store layer plus a set of
presentational components. At merge, frontend coverage was ~12.8% lines
(222 tests).

This issue tracks finishing the frontend backfill toward the 80% target and
flipping the coverage gate to blocking.

Scope

1. Component test backfill (the bulk)

~90 Svelte components remain untested. Priority order (highest logic/traffic first):

  • Forms: friend-form.svelte (517 LOC), the remaining *-edit-form.svelte
    (email/url/date/address/social-profile/circle/relationship), collective-form,
    encounter-form, notification-channel forms.
  • List/grid/detail: friend-list.svelte (653), friend-grid.svelte (419),
    friend-detail.svelte (456), collective-detail.svelte (see Refactor: split collective-detail.svelte (893 LOC) into focused pieces #187),
    encounter-list, circle views.
  • Search: facet-dropdown.svelte (586), global-search.svelte (446),
    facet-chips.
  • Address inputs: hierarchical-address-input (472), street-input,
    house-number-input, postal-code-input, city-select.
  • Misc: badges, selects, modals, friend-multi-select, image-crop-modal.

2. Flip the coverage gate to blocking

Once the repo baseline clears 80%, change packages/danger/src/rules/coverage.ts
from report-only to failing: danger-plugin-coverage only posts a table (it never
calls fail()), so add an explicit fail() when changed files fall below the
80% threshold. See the note in that rule.

3. (Optional) Backend coverage in CI

Backend coverage is currently not generated in CI because v8 instrumentation
slows the better-auth integration tests past their 5s timeout. Options: raise
testTimeout under coverage, or run coverage only over the unit suite. Then add
apps/backend/coverage/clover.xml to the danger rule (the path is already listed).

Established patterns (from PR #186)

  • Helpers in apps/frontend/src/lib/test/render, stubFetch/jsonResponse,
    createUpdateRecorder, and typed fixtures (aFriend, aCollective, ...).
  • Mock modules with shared state via vi.hoisted (see stores/auth.test.ts,
    stores/friends.test.ts).
  • For i18n components, mock $lib/i18n so $i18n.t echoes the key, and match
    labels as substrings — required fields append " *" (see
    subresources/phone-edit-form.test.ts).
  • Subresource rows render twice (mobile + desktop) — use getAllBy*.
  • Run the full local gate before pushing: vitest + biome check +
    aube --filter @freundebuch/frontend run type-check.

Acceptance criteria

  • Frontend coverage ≥ 80% (lines) per the danger report.
  • Coverage gate flipped to blocking.
  • aube type-check, aube run check, and the full test suite stay green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions