Skip to content

Commit

Permalink
feat: updated Loader.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkparti committed Jul 18, 2023
1 parent 9dd195e commit 0127b3a
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions src/components/UI/components/Loader/Loader.test.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import React from "react";
import { shallow } from "enzyme";
import { CircularProgress } from "@mui/material";
import { LoaderGrid } from "./LoaderStyled";
import { Loader } from "./Loader";
import React from 'react';
import { ThemeProvider } from '@mui/material';
import { Loader } from './Loader';
import theme from '../../theme';
import { render, screen } from '@testing-library/react';

describe("Loader component", () => {
it("renders without crashing", () => {
const wrapper = shallow(<Loader />);
expect(wrapper.exists()).toBe(true);
});
describe('Loader component', () => {

it("renders the LoaderGrid component", () => {
const wrapper = shallow(<Loader />);
const loaderGridComponent = wrapper.find(LoaderGrid);
expect(loaderGridComponent).toHaveLength(1);
});
const TestWrapper = (props) => <ThemeProvider theme={theme}>{props.children}</ThemeProvider>;

it('should render correctly', () => {
render(<TestWrapper>
<Loader />
</TestWrapper>);

expect(screen.getByRole('progressbar')).toBeInTheDocument();

it("renders the CircularProgress component", () => {
const wrapper = shallow(<Loader />);
const circularProgressComponent = wrapper.find(CircularProgress);
expect(circularProgressComponent).toHaveLength(1);
});
});

0 comments on commit 0127b3a

Please sign in to comment.