Skip to content

Commit

Permalink
Test: Increasing the test level
Browse files Browse the repository at this point in the history
- Trying to meet the code coverage level for Loader component.

Signed-off-by: Akhilender <[email protected]>
  • Loading branch information
akhilender-bongirwar committed Nov 11, 2023
1 parent 24a0c08 commit c90868d
Showing 1 changed file with 3 additions and 32 deletions.
35 changes: 3 additions & 32 deletions src/components/Loader/Loader.test.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';

import Loader from './Loader';

describe('Testing Loader component', () => {
test('Component should be rendered properly', () => {
render(
<BrowserRouter>
<Loader />
</BrowserRouter>
);
render(<Loader />);

expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument();
expect(screen.getByTestId('spinner')).toBeInTheDocument();
});

test('Component should render on custom sizes', () => {
render(
<BrowserRouter>
<Loader size="sm" />
</BrowserRouter>
);
render(<Loader size="sm" />);

const spinner = screen.getByTestId('spinner');
expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument();
Expand All @@ -32,11 +22,7 @@ describe('Testing Loader component', () => {
});

test('Component should render with large size', () => {
render(
<BrowserRouter>
<Loader size="lg" />
</BrowserRouter>
);
render(<Loader size="lg" />);

const spinner = screen.getByTestId('spinner');
expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument();
Expand All @@ -45,19 +31,4 @@ describe('Testing Loader component', () => {
'_spinnerLg_1vy2z_15 spinner-border text-primary'
);
});

test('renders with extra-large size', () => {
render(
<BrowserRouter>
<Loader size="xl" />
</BrowserRouter>
);

const spinner = screen.getByTestId('spinner');
expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument();
expect(spinner).toBeInTheDocument();
expect(spinner).toHaveClass(
'_spinnerXl_1vy2z_9 spinner-border text-primary'
);
});
});

0 comments on commit c90868d

Please sign in to comment.