Skip to content

Commit ceac7ce

Browse files
author
Your Name
committed
test: improve coverage for Tasks component
1 parent 0f6b972 commit ceac7ce

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

frontend/src/components/HomeComponents/Tasks/__tests__/Tasks.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ jest.mock('../Pagination', () => {
173173
));
174174
});
175175

176+
// Mock TaskSkeleton component
177+
jest.mock('../TaskSkeleton', () => {
178+
return {
179+
__esModule: true,
180+
Taskskeleton: () => <div data-testid="task-skeleton" />,
181+
};
182+
});
183+
176184
global.fetch = jest.fn().mockResolvedValue({ ok: true });
177185

178186
describe('Tasks Component', () => {
@@ -217,6 +225,13 @@ describe('Tasks Component', () => {
217225
expect(dropdown).toBeInTheDocument();
218226
expect(dropdown).toHaveValue('10');
219227
});
228+
229+
test('does not render tasks when loading is true', () => {
230+
render(<Tasks {...mockProps} isLoading={true} />);
231+
232+
// No task rows should be rendered while loading
233+
expect(screen.queryByRole('row')).not.toBeInTheDocument();
234+
});
220235
});
221236

222237
describe('LocalStorage', () => {

0 commit comments

Comments
 (0)