import React from 'react'; import { render, screen, fireEvent } from '@testing-library/react'; import Search from '../src/components/home/Search.jsx'; describe('Search Component', () => { it('should render the Search button', () => { render( {}} item="testItem" />); const searchButton = screen.getByText(/find/i); expect(searchButton).toBeInTheDocument(); }); it('should call the search function with the correct item when clicked', () => { const mockSearch = jest.fn(); const item = 'testItem'; render(); const searchButton = screen.getByText(/find/i); fireEvent.click(searchButton); expect(mockSearch).toHaveBeenCalledWith(item); }); });