Skip to content

Add unit tests for getSearchableText utility function#40

Merged
amattu2 merged 2 commits intounit-testingfrom
copilot/sub-pr-39
Dec 8, 2025
Merged

Add unit tests for getSearchableText utility function#40
amattu2 merged 2 commits intounit-testingfrom
copilot/sub-pr-39

Conversation

Copy link

Copilot AI commented Dec 8, 2025

Overview

Added comprehensive unit tests for the getSearchableText utility function which filters search terms by length and normalizes whitespace.

Change Details (Specifics)

Created Utils/index.test.js with 15 test cases covering:

  • Term filtering (removes words ≤2 characters)
  • Whitespace normalization (extra, leading, trailing spaces)
  • Edge cases (empty input, whitespace-only, single words)
  • Boundary conditions (1, 2, 3 character terms)
  • Preservation of case and special characters

Example test case:

it('should filter out terms with 2 or fewer characters', () => {
  const result = utils.getSearchableText('hello to a world');
  expect(result).toBe('hello world');
});

Related Ticket(s)

INS-1461


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: amattu2 <38357871+amattu2@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit tests for getSearchableText function Add unit tests for getSearchableText utility function Dec 8, 2025
Copilot AI requested a review from amattu2 December 8, 2025 15:50
@amattu2 amattu2 marked this pull request as ready for review December 8, 2025 15:59
@amattu2 amattu2 merged commit 787891e into unit-testing Dec 8, 2025
3 of 6 checks passed
@amattu2 amattu2 deleted the copilot/sub-pr-39 branch December 8, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants