import { render, screen, fireEvent } from '@testing-library/react'; import UpdateAllButton from './UpdateAllButton'; describe('UpdateAllButton', () => { const onUpdateAllMock = jest.fn(); beforeEach(() => { onUpdateAllMock.mockClear(); }); it('should display "No updates available" when disabled', () => { render(); expect(screen.getByText('No updates available')).toBeInTheDocument(); expect(screen.getByRole('button')).toBeDisabled(); }); it('should display update count and be clickable when enabled', () => { render(); const button = screen.getByRole('button'); expect(button).toHaveTextContent('Update all (3)'); expect(button).toBeEnabled(); fireEvent.click(button); expect(onUpdateAllMock).toHaveBeenCalledTimes(1); }); });