-
-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improving test coverage for Loader Component
- Fixed lint errors Signed-off-by: Akhilender <[email protected]>
- Loading branch information
1 parent
93b7572
commit 9c7c6fb
Showing
1 changed file
with
13 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
); | ||
}); | ||
}); |