Skip to content

[MEDIUM] Test coverage gaps: 9 Rust modules have zero tests, notably employees.rs #39

@matthewod11-stack

Description

@matthewod11-stack

Description

Of 34 Rust modules, 9 have no #[cfg(test)] block at all. The highest-risk gap is employees.rs — the most-written-to table, with a non-trivial dynamic WHERE clause builder (build_employee_filter at employees.rs:183-215). An off-by-one in condition joining silently returns wrong data.

Current State

Untested modules (grep confirms no #[cfg(test)]):

  • src-tauri/src/employees.rs ⚠️ (riskiest — dynamic SQL builder)
  • src-tauri/src/enps.rs
  • src-tauri/src/review_cycles.rs
  • src-tauri/src/performance_ratings.rs
  • src-tauri/src/company.rs
  • src-tauri/src/settings.rs
  • src-tauri/src/provider.rs
  • src-tauri/src/network.rs
  • src-tauri/src/device_id.rs

Current: 382 passing tests, primarily concentrated in context.rs, chat.rs, pii.rs, data_quality.rs, memory.rs, highlights.rs.

Suggested Fix

Prioritize by risk:

  • employees.rs::build_employee_filter — minimum: empty filter, single condition, multi-condition (AND join), edge values.
  • provider.rs — factory test (resolves correct provider for each id).
  • enps.rs, review_cycles.rs, performance_ratings.rs — basic CRUD + a query-edge-case test each.
  • company.rs, settings.rs — upsert semantics.
  • network.rs, device_id.rs — probably not worth extensive unit testing; document rationale if skipped.

Verification

  • cargo test --manifest-path src-tauri/Cargo.toml passes with >420 tests (current 382 + at least 40 new).
  • Every module under src-tauri/src/ has either a #[cfg(test)] block or a brief code comment explaining why no unit tests (e.g., "integration-test only").

Automation Hints

scope: src-tauri/src/{employees,enps,review_cycles,performance_ratings,company,settings,provider}.rs
do-not-touch: existing tests
approach: add-declarations
risk: low
max-files-changed: 7
blocked-by: none
bail-if: none

Priority

Medium — prevents silent regressions in the most-used paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    hardeningReliability or defense-in-depth improvementtech-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