Unit Tests
This directory contains unit tests for the desktop application components.
Operator Parsing Tests
operator-parsing.test.mjs
Comprehensive test suite for search operator parsing functionality. Tests include:
- Basic operator detection: AND/OR (capitalized and lowercase)
- Mixed operator handling: Queries with both AND and OR operators
- UI operator override: How UI operator controls interact with text operators
- Term extraction: Proper parsing of search terms from complex queries
- Search query building: Conversion of parsed input to search API format
operator-parsing.test.mjs
Comprehensive test suite for search operator parsing functionality (ES modules format).
autocomplete-parsing.test.mjs
Test suite for autocomplete suggestion application and parsing integration. Tests include:
- Partial term replacement: When autocomplete suggestions replace partial terms
- Multi-word suggestions: Handling suggestions with multiple words
- Operator integration: How suggestions work with AND/OR operators
- Edge cases: Complex queries and various input scenarios
Running the Tests
# Run the operator parsing tests
# Run the autocomplete parsing tests
Test Coverage
These tests ensure that:
- AND and OR operators are correctly detected and parsed
- Mixed operator queries are handled properly
- UI operator controls properly override text operators
- Search behavior changes correctly based on operator selection
- Terms are extracted cleanly without operator artifacts
Integration with Main Test Suite
These unit tests complement the existing Playwright e2e tests by providing focused testing of the search parsing logic in isolation, making it easier to debug operator-related issues and ensure consistent behavior across different input scenarios.