Skip to content

Frontend test floor: vitest + RTL + mockIPC on the trial-funnel surfaces (Tier 2 opener) #115

Description

@matthewod11-stack

Description

23,714 LOC of React UI ship on type-check only — zero test files, no framework. This issue pre-scopes the minimal floor so it's pickup-ready the moment the sell sprint ends. Explicitly NOT to be built during the sell sprint (the 5/29 review's REC-7 deferral holds; one human install-and-click pass beats tests this week). (Audit finding 1.2, R-21 reconfirmed.)

Current State

  • package.json: no vitest/jest/@testing-library; zero *.test.tsx? under src/
  • Highest-risk untested logic, ranked:
    1. src/contexts/ConversationContext.tsx (789 lines) — streaming with 30s inactivity timeout (:376-405), chunk buffering + done-handler + fire-and-forget audit (:446-494), fail-closed PII scan (:332-350)
    2. Import pipeline (~2.9K LOC bulk-mutating customer HR data): RatingsImport 606, ColumnMappingStep 571, ReviewsImport 568, useImportPipeline 446, EnpsImport 439, EmployeeImport 417
    3. Trial/purchase/onboarding: UpgradePrompt 353, ApiKeyStep 349, ApiKeyInput 292

Suggested Fix

  • Add vitest + @testing-library/react + jsdom config (no app code changes)
  • Floor 1: stream-handling unit tests for ConversationContext reducer/handlers (timeout, chunk buffering, done, error paths)
  • Floor 2: pure-function tests for import mapping/validation (column mapping, dedupe, error rows)
  • Wire npm test into CI alongside tsc

Verification

  • npm test green in CI on a clean checkout
  • Coverage report exists for the two floor areas (no numeric gate yet)

Automation Hints

scope: package.json, vitest.config.ts, src/contexts/, src/components/import/, src/hooks/useImportPipeline*
do-not-touch: src-tauri/, proxy/
approach: add-tests
risk: low
max-files-changed: 15
blocked-by: none
bail-if: testing requires refactoring components to be testable beyond extracting pure functions

Priority

Medium — remove the deferred label when the sell sprint ends (~2-3 days of work).

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtEligible for automated overnight fixingtestingAdd or fix tests

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions