Skip to content

[BE-120] Unit tests for the risk-assessment module #979

Description

@mftee

Overview

backend/src/risk-assessment/ has 3 files and no tests. Risk scoring is the product's core intelligence — a wrong score on a land document could contribute to a real dispute, so its logic deserves explicit, example-based verification.

Tasks

  • Test each risk heuristic in isolation with inputs that should and should not trigger it.
  • Test score aggregation across multiple flags, and verify the score stays within its defined range.
  • Test boundary cases: no flags, all flags, and conflicting signals.
  • Test that scoring is deterministic — the same document must always yield the same score.
  • Document what each risk flag means and what evidence triggers it, as part of the test names.
  • Target ≥80% coverage — this module warrants a higher bar than most.

Acceptance Criteria

  • Every risk heuristic has explicit positive and negative test cases.
  • Scores are proven deterministic and bounded.
  • npm run test -- risk-assessment passes at ≥80% coverage.

Notes for Contributors

Comment below to be assigned.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions