Skip to content

Comments

fix(test): extract shared test utilities and fix infrastructure issues#317

Merged
fpindej merged 1 commit intomasterfrom
fix/test-infrastructure-300
Feb 24, 2026
Merged

fix(test): extract shared test utilities and fix infrastructure issues#317
fpindej merged 1 commit intomasterfrom
fix/test-infrastructure-300

Conversation

@fpindej
Copy link
Owner

@fpindej fpindej commented Feb 24, 2026

Summary

  • Extract duplicated MOCK_USER and EVENT_DEFAULTS from 3 test files into a shared src/frontend/src/test-utils.ts module with createMockLoadEvent() factory and createMockCookies() helper
  • Fix vi.stubGlobal leak in health.test.ts by adding vi.unstubAllGlobals() in afterEach (and re-stubbing document in beforeEach since the cleanup removes it between tests)
  • Remove passWithNoTests: true from vitest config — the project now has 217 tests across 10 test files, so this safety net is no longer needed and would mask accidental test deletion

Closes #300

Test plan

  • All 217 tests pass (pnpm run test)
  • svelte-check passes with 0 errors
  • ESLint + Prettier pass
  • Verified health tests properly clean up global stubs between test runs

🤖 Generated with Claude Code

- Extract MOCK_USER and EVENT_DEFAULTS into shared test-utils.ts with
  createMockLoadEvent() factory and createMockCookies() helper
- Update root layout, (app) layout, and login page tests to import
  from shared module instead of duplicating setup
- Fix vi.stubGlobal leak in health.test.ts by adding vi.unstubAllGlobals()
  in afterEach and re-stubbing document in beforeEach
- Remove passWithNoTests: true from vitest config now that the project
  has substantial test coverage

Closes #300

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fpindej fpindej added the frontend Frontend (SvelteKit) label Feb 24, 2026
@fpindej fpindej merged commit 449dd4e into master Feb 24, 2026
4 checks passed
@fpindej fpindej deleted the fix/test-infrastructure-300 branch February 24, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Frontend (SvelteKit)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(frontend): fix test infrastructure issues

1 participant