Skip to content

Commit

Permalink
Improving test coverage for Loader Component
Browse files Browse the repository at this point in the history
- Fixed lint errors

Signed-off-by: Akhilender <[email protected]>
  • Loading branch information
akhilender-bongirwar committed Nov 11, 2023
1 parent 93b7572 commit 9c7c6fb
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions src/components/Loader/Loader.test.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
import React from "react";
import { render, screen } from "@testing-library/react";
import Loader from "./Loader";
import React from 'react';
import { render, screen } from '@testing-library/react';
import Loader from './Loader';

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

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

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

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

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

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

0 comments on commit 9c7c6fb

Please sign in to comment.