Skip to content

test(frontend): improve frontend test breadth for search controller#404

Open
SaitejaKommi wants to merge 1 commit intoopenfoodfacts:mainfrom
SaitejaKommi:test/frontend-test-breadth
Open

test(frontend): improve frontend test breadth for search controller#404
SaitejaKommi wants to merge 1 commit intoopenfoodfacts:mainfrom
SaitejaKommi:test/frontend-test-breadth

Conversation

@SaitejaKommi
Copy link
Copy Markdown

Summary

This PR begins closing the frontend coverage gap by adding explicit tests for the central search controller mixin responsible for orchestrating search URL mappings, parameters, and signal-driven interactions.

It introduces a dedicated test harness to validate core state behavior, DOM interactions, and component instance isolation, reducing regression risk in complex controller flows.


Related Issue

Fixes #403


What Changed

Added Dedicated Test Harness

Created:

  • search-ctl_test.ts

Introduced Mock Controller Component

Added DummySearchCtl, a lightweight test component wrapping the search mixin to expose:

  • Controller properties
  • Internal state behavior
  • DOM parsing logic
  • Signal/event interactions

Expanded Coverage

Added tests covering:

  • autoLaunch override behavior
  • Signal event capture from events such as SearchaliciousEvents.FACET_SELECTED
  • Component name separation / multi-instance isolation rules
  • Core controller property interactions

Affected Files

  • search-ctl_test.ts

Testing

Verification gateway executed successfully:

  • Backend unit tests ✅
  • Backend integration tests ✅
  • Frontend build/tests (dev) ✅
  • Frontend build/tests (prod) ✅

Notes

This is a frontend quality improvement focused on increasing confidence around complex search controller state transitions and preventing regressions.

Added search-ctl_test.ts to cover SearchaliciousSearchMixin properly.
Covered state-heavy multi-search-name isolation, property initialization, and mocked event handling for components.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (ready for dev)

Development

Successfully merging this pull request may close these issues.

Improve frontend test breadth (state-heavy components under-tested)

1 participant