ui phase 1

This commit is contained in:
hamid
2026-07-17 17:10:39 +03:30
parent f1cba6cf74
commit 370c1beefa
151 changed files with 4254 additions and 1840 deletions
@@ -0,0 +1,20 @@
import { render, screen, fireEvent } from '@testing-library/react';
import { ThemeProvider } from '../../../theme';
import ErrorState from './ErrorState';
describe('<ErrorState/>', () => {
const wrap = (ui: React.ReactNode) => render(<ThemeProvider>{ui}</ThemeProvider>);
it('renders the message and calls onRetry on click', () => {
const onRetry = jest.fn();
wrap(<ErrorState message="Couldn't load" retryLabel="Retry" onRetry={onRetry} />);
expect(screen.getByText("Couldn't load")).toBeInTheDocument();
fireEvent.click(screen.getByRole('button'));
expect(onRetry).toHaveBeenCalledTimes(1);
});
it('renders the caller-supplied retry label', () => {
wrap(<ErrorState message="Failed" retryLabel="Try again" onRetry={jest.fn()} />);
expect(screen.getByRole('button', { name: 'Try again' })).toBeInTheDocument();
});
});