Fix tests after initial tailwind components migration

This commit is contained in:
Alejandro Celaya
2025-04-02 09:33:28 +02:00
parent a63c214d8d
commit 7c31b210bd
6 changed files with 67 additions and 46 deletions

View File

@@ -4,11 +4,11 @@ import { checkAccessibility } from '../__helpers__/accessibility';
import { renderWithEvents } from '../__helpers__/setUpTest';
describe('<AppUpdateBanner />', () => {
const toggle = vi.fn();
const onClose = vi.fn();
const forceUpdate = vi.fn();
const setUp = async () => {
const result = await act(
() => renderWithEvents(<AppUpdateBanner isOpen toggle={toggle} forceUpdate={forceUpdate} />),
() => renderWithEvents(<AppUpdateBanner isOpen onClose={onClose} forceUpdate={forceUpdate} />),
);
await waitFor(() => screen.getByRole('alert'));
@@ -28,9 +28,9 @@ describe('<AppUpdateBanner />', () => {
it('invokes toggle when alert is closed', async () => {
const { user } = await setUp();
expect(toggle).not.toHaveBeenCalled();
expect(onClose).not.toHaveBeenCalled();
await user.click(screen.getByLabelText('Close'));
expect(toggle).toHaveBeenCalled();
expect(onClose).toHaveBeenCalled();
});
it('triggers the update when clicking the button', async () => {

View File

@@ -30,6 +30,5 @@ describe('<NotFound />', () => {
expect(link).toHaveAttribute('href', expectedLink);
expect(link).toHaveTextContent(expectedText);
expect(link).toHaveAttribute('class', 'btn btn-outline-primary btn-lg');
});
});