Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ jest.mock('../Pagination', () => {
));
});

jest.mock('../TaskSkeleton', () => {
return {
__esModule: true,
Taskskeleton: () => <div data-testid="task-skeleton" />,
};
});

global.fetch = jest.fn().mockResolvedValue({ ok: true });

describe('Tasks Component', () => {
Expand Down Expand Up @@ -217,6 +224,33 @@ describe('Tasks Component', () => {
expect(dropdown).toBeInTheDocument();
expect(dropdown).toHaveValue('10');
});

test('does not render tasks when loading is true', () => {
render(<Tasks {...mockProps} isLoading={true} />);
expect(screen.queryByRole('row')).not.toBeInTheDocument();
});

test('renders tasks container when loading is false', () => {
render(<Tasks {...mockProps} isLoading={false} />);
expect(screen.getByTestId('tasks')).toBeInTheDocument();
});

test('renders BottomBar component', () => {
render(<Tasks {...mockProps} />);
expect(screen.getByText('Mocked BottomBar')).toBeInTheDocument();
});

test('renders tasks section with correct id', () => {
render(<Tasks {...mockProps} />);
const section = document.querySelector('section#tasks');
expect(section).toBeInTheDocument();
});

test('renders Tasks component without crashing', () => {
expect(() => {
render(<Tasks {...mockProps} />);
}).not.toThrow();
});
});

describe('LocalStorage', () => {
Expand Down
Loading