Skip to content

test(frontend): cover contexts, useDebounce and add a providers render helper - #573

Merged
JuliusHenke merged 1 commit into
masterfrom
chore/frontend-context-tests
Oct 10, 2026
Merged

JuliusHenke merged 1 commit into
masterfrom
chore/frontend-context-tests

Conversation

@JuliusHenke

Copy link
Copy Markdown
Member

Summary

Third step of the frontend testing plan (follows #570, #571).

  • settings-context.test.tsx: defaults, all three input-name branches of changeSettings, setSettings, and the selection reset when country/family grouping is off.
  • date-context.test.tsx: latest day selection, manual selection, the "historic data is processing" snackbar and its absence for a complete history, empty list.
  • statistics-context.test.tsx: initial zeros and updates.
  • util.test.ts: useDebounce (initial value, delay, restart on change, ignores undefined; fake timers), nameOfFactory, backend base URL and headers.
  • src/test/render.tsx: renderWithProviders and createProvidersWrapper mirror index.tsx (theme, snackbar, jotai, settings, date, statistics) with a fresh jotai store per call and settings overrides. A harness test exercises it. The component and flow tests in the next PR build on it.

No production code changed.

Coverage

Whole project: 46.8% lines (was 33.7%). context/ and util/util.ts are at 100%.

Deployment notes

None.

Dependency vetting

No dependency changes. msw is still unused; it comes with the data-loading flow tests.

Verification (Node 24)

  • 113 tests pass in total (45 unit, 68 browser); browser project about 3.4 s, dominated by importing MUI.
  • tsc clean, eslint 0 errors (3 existing warnings).
  • Browser project was run outside the Claude Code sandbox, which blocks Chromium.

🤖 Generated with Claude Code

…r helper

Adds browser-mode tests for the settings, date and statistics contexts and
for useDebounce, nameOfFactory and the backend client. Adds
renderWithProviders / createProvidersWrapper that mirror index.tsx with a
fresh jotai store per test, for the component tests that follow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@JuliusHenke JuliusHenke added enhancement New feature or request frontend labels Oct 10, 2026
@github-actions

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 6191771):

https://tormap-36f44--pr573-chore-frontend-conte-42f1atyl.web.app

(expires Mon, 09 Nov 2026 14:08:03 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 0c1f71965de18e60b0e686b0d0356977fec090dc

@JuliusHenke
JuliusHenke merged commit 6647ee9 into master Oct 10, 2026
13 checks passed
@JuliusHenke
JuliusHenke deleted the chore/frontend-context-tests branch October 10, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant