Skip to content

Testing

  • Frontend: Vitest + React Testing Library + jsdom
  • Backend: Rust’s built-in #[test] with cargo test
Terminal window
# All frontend tests
pnpm test
# Watch mode
cd apps/desktop && pnpm vitest
# Rust tests
cd apps/desktop/src-tauri && cargo test
Test fileWhat it covers
apps/desktop/src/components/InputComposer.test.tsxComposer rendering, mode toggle, submit
apps/desktop/src/components/PlanPanel.test.tsxPlan display, risk confirmation, edit-and-approve
apps/desktop/src/lib/shortcuts.test.tsShortcut parsing, zone matching, combo resolution
packages/domain/src/memoryDetectors.test.tsAll three detectors: thresholds, confidence, dedup
packages/state/src/index.test.tsZustand store operations
packages/api-contract/src/contracts.test.tsType contract validation

The planner module has comprehensive tests:

TestWhat it verifies
test_mock_planner_git_statusMock recognizes “changed files” intent
test_mock_planner_destructiveMock flags “delete” as high risk
test_mock_planner_genericMock generates stub for unknown intents
test_llm_response_conversionLLM response maps correctly to plan payload
test_llm_response_safety_flagsDestructive flag generates DESTRUCTIVE_OPERATION

Memory detectors, context builders, and type utilities are pure functions. They take data in, return data out, with no side effects. Test them with simple input/output assertions.

Most components receive props and callbacks. Test them with React Testing Library: render with props, assert DOM content, simulate user actions, verify callback invocations.

Zustand stores can be tested independently. Create a store, call actions, assert state changes.

The mock bridge provides a complete simulation of the backend. Running the app in browser preview and interacting with it exercises the full frontend stack against plausible responses.

  1. New domain type? Add type assertions in contracts.test.ts
  2. New detector? Add detector tests in memoryDetectors.test.ts
  3. New component? Add component tests with React Testing Library
  4. New shortcut? Add shortcut test in shortcuts.test.ts
  5. New Tauri command? Add Rust tests in the command module
  6. New mock handler? Test through browser preview manually

The Smoke Test Checklist provides a manual verification sequence covering boot, raw shell, semantic flow, persistence, memory, and accessibility.