feat: add tests and assert coverage #71

Merged
naomi merged 7 commits from feat/testy into main 2026-01-26 00:26:04 -08:00

7 Commits

Author SHA1 Message Date
naomi 1f5f95c8f3 style: fix strict clippy and TypeScript type errors
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 56s
CI / Lint & Test (pull_request) Successful in 15m50s
CI / Build Linux (pull_request) Successful in 19m46s
CI / Build Windows (cross-compile) (pull_request) Successful in 29m28s
- Fix assertions on constants in clipboard.rs (use const blocks)
- Fix unnecessary unwrap after is_ok check in git.rs
- Remove redundant u64 >= 0 comparison in stats.rs
- Add #[allow(clippy::useless_vec)] to sorting tests
- Add missing beforeEach import to vitest.setup.ts
- Change global.Audio to globalThis.Audio in notifications.test.ts
- Add type annotations to fix null type narrowing in conversations.test.ts
2026-01-25 23:48:14 -08:00
naomi be25152eea chore: format
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 54s
CI / Lint & Test (pull_request) Failing after 5m52s
CI / Build Linux (pull_request) Has been skipped
CI / Build Windows (cross-compile) (pull_request) Has been skipped
2026-01-25 23:35:03 -08:00
hikari d3bb62210d style: fix lint errors in test files
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 53s
CI / Lint & Test (pull_request) Failing after 5m54s
CI / Build Linux (pull_request) Has been skipped
CI / Build Windows (cross-compile) (pull_request) Has been skipped
- Remove unused imports in config.test.ts and conversations.test.ts
- Remove unused handler variable in tauri.test.ts
- Remove unused _args parameter in vitest.setup.ts mock
- Add coverage/ to eslint ignore list
2026-01-25 23:28:45 -08:00
hikari 8cb4c17dc1 test: expand test coverage for backend and frontend modules
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 58s
CI / Lint & Test (pull_request) Failing after 5m51s
CI / Build Linux (pull_request) Has been skipped
CI / Build Windows (cross-compile) (pull_request) Has been skipped
- Add 25+ tests for temp_manager.rs (0% -> 96.59% coverage)
- Expand sessions.rs tests (23% -> 68.50% coverage)
- Expand quick_actions.rs tests (23% -> 71.13% coverage)
- Expand snippets.rs tests (23% -> 72.32% coverage)
- Expand stats.rs tests with cost calculation and streak tests
- Add frontend test infrastructure with Tauri mocks
- Add tests for conversations, quickActions, and snippets stores
- Total backend tests: 298 passing
2026-01-25 23:18:03 -08:00
naomi bee4eb393e ci: enforce coverage thresholds in CI pipeline
- Run frontend tests with coverage thresholds (15% lines/statements)
- Add llvm-tools-preview component for Rust coverage
- Install cargo-llvm-cov and enforce 50% line coverage for backend
- CI will now fail if coverage drops below thresholds
2026-01-25 22:49:59 -08:00
naomi 78b951a865 ci: add coverage tooling for frontend and backend
- Add @vitest/coverage-v8 for frontend test coverage
- Configure vitest with coverage thresholds (15% statements/lines, 13% branches/functions)
- Add npm scripts for backend testing and coverage with cargo-llvm-cov
- Add test:all and coverage:all scripts for unified test execution
- Exclude coverage directory from git tracking
2026-01-25 22:48:01 -08:00
hikari cd15247dea test: add comprehensive test coverage for backend and frontend
Backend (177 new tests):
- achievements.rs: 108 tests covering all achievement categories, unlock logic,
  serialization, and progress tracking
- commands.rs: 19 tests for validate_directory, get_file_size, and struct serialization
- git.rs: 31 tests with real temporary git repos for status, diff, stage, commit, log
- clipboard.rs: 19 tests for ClipboardEntry, ClipboardHistory, sorting, and filtering

Frontend (141 new tests):
- stats.test.ts: 19 tests for stats store and formattedStats derived store
- config.test.ts: 40 tests for theme, font size, path masking, and config store
- slashCommands.test.ts: 48 tests for parseSlashCommand, getMatchingCommands, isSlashCommand
- notifications.test.ts: 34 tests for NotificationType, NOTIFICATION_SOUNDS, SoundPlayer

Total test count increased from ~55 to 373 tests (216 backend + 157 frontend)
2026-01-25 22:38:48 -08:00