Skip to content

Search module has minimal tests: 13 files covered by one service spec #1133

Description

@nanaf6203-bit

Search module has minimal tests: 13 files covered by one service spec

Labels / Complexity: testing · Medium Complexity — Medium

Problem

src/search/ spans 13 files (search, autocomplete, facets, filters, history, export, image search, voice search) yet has just 1 spec (search.service.spec.ts, plus test/unit/search-facets.service.spec.ts). Autocomplete ranking, filter composition, and history behavior — including the in-memory fallback (#50) — are unpinned. A regression in facet or autocomplete logic ships silently.

Why this is architecturally hard

  1. Query composition is the test design. Filter/facet logic builds Prisma where clauses; tests must assert on the composed query shapes, which needs good mock fixtures.
  2. Several services share the module. Autocomplete, history, filters, and export each need coverage; the plan must scope per service.

Acceptance criteria

  • Tests cover autocomplete suggestion ranking, facet counts, and filter composition.
  • The in-memory history fallback path (added the comprehensive audit log compaliance #50) is covered so the migration cannot change behavior silently.
  • Tests run in CI via npm test.

Out of scope

Changing search behavior; the history durability migration (#50).

Getting started

  • src/search/search-autocomplete.service.ts — the autocomplete logic
  • src/search/search-filters.service.ts — the filter composition

Commands: npm test, npm run test:cov.

Good first files to read: src/search/search.service.spec.ts, src/search/search-autocomplete.service.ts.

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