import React from 'react'; import { render } from '@testing-library/react'; import { Highlighter } from './Highlighter'; // adjust the import path accordingly test('renders children when there is no search term', () => { const { container } = render(Test Text); expect(container.innerHTML).toContain('Test Text'); }); test('highlights the search term', () => { const { container } = render( Test Text ); expect(container.innerHTML).toContain('Test'); }); test('does not highlight when search term is not present in children', () => { const { container } = render( Test Text ); expect(container.innerHTML).not.toContain(''); }); test('is case insensitive by default', () => { const { container } = render( Test Text ); expect(container.innerHTML).toContain('Test'); }); test('respects case sensitivity when specified', () => { const { container } = render( Test Text ); expect(container.innerHTML).not.toContain(''); });