Skip to content

Add unit tests for src/backend/pii/masking_service.go #430

@hanneshapke

Description

@hanneshapke

src/backend/pii/masking_service.go orchestrates detection + generator lookup + mapping persistence, but lacks a dedicated masking_service_test.go. Sibling files (database.go, generators, detectors) all have tests.

What to add

Create src/backend/pii/masking_service_test.go covering:

  • A string containing 2–3 PII types — each is masked, original/masked pairs are stored in the mapper
  • Repeated identical PII — should map to the same dummy value within a session
  • No PII in input — output equals input, no mappings stored
  • Mixed-language / unicode input — does not panic and round-trips correctly

Hints

  • Stub the detector to return a fixed []Entity rather than running ONNX in tests.
  • Reuse database_test.go patterns.
  • Run go test ./src/backend/pii/....

Difficulty: good first issue, ~1–2 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions