Skip to content

5.1.1 TEST-001 Jest unit coverage for parseSearchQuery #388

Description

@flyblackbox

TEST-001 Jest unit coverage for parseSearchQuery

Status

Implementation is under review in #438.

Summary

Add deterministic Jest unit coverage for the existing search-query parsing utility. The parser should safely distinguish ordinary search text from @username and #hashtag tokens while preserving the existing fields consumed by search callers.

Implementation approach

PR #438 preserves the existing textQuery and tokens contract and adds a keywords field rather than replacing the parser with a new incompatible return shape.

Coverage

  • Plain keyword queries
  • @username queries
  • #hashtag queries
  • Mixed query types
  • Empty and whitespace-only input
  • Invalid or incomplete tokens
  • Repeated whitespace and casing behavior
  • Multiple supported tokens
  • Backend search-input compatibility coverage
  • Maintainer review of backward compatibility
  • Merge TEST-001: Add unit test coverage for parseSearchQuery + keywords field #438 to main

Acceptance criteria

  • Jest tests cover keywords, usernames, hashtags, mixed queries, and edge cases.
  • Parsing remains deterministic and safely handles incomplete tokens.
  • Existing textQuery and tokens consumers remain compatible.
  • No browser-dependent assertions are introduced into the parser unit suite.
  • The frontend and backend test suites pass in CI.
  • TEST-001: Add unit test coverage for parseSearchQuery + keywords field #438 is merged to main.

Test commands

npm test -- parseSearchQuery
npm run build

Playwright may cover end-to-end search behavior separately; it is outside the unit-testing scope of this issue.

Related work

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions