mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-02-20 07:01:03 -05:00
35 lines
978 B
JavaScript
35 lines
978 B
JavaScript
/* global expect */
|
|
import React from 'react';
|
|
import { render, cleanup } from '@testing-library/react';
|
|
|
|
import Loader from './Loader';
|
|
|
|
describe('<Loader />', () => {
|
|
afterEach(cleanup);
|
|
|
|
it('renders to the DOM', () => {
|
|
const { container } = render(<Loader />);
|
|
expect(container).toBeTruthy();
|
|
});
|
|
|
|
it('adds the correct class when given a fullScreen prop', () => {
|
|
const { container } = render(<Loader fullScreen={true} />);
|
|
expect(container.firstChild).toHaveClass('full-screen-wrapper');
|
|
});
|
|
|
|
/**
|
|
* As we only wrap another library Component,
|
|
* there is nothing much to test except snapshots
|
|
*/
|
|
|
|
it('matches to the default render snapshot', () => {
|
|
const { container } = render(<Loader />);
|
|
expect(container.firstChild).toMatchSnapshot();
|
|
});
|
|
|
|
it('matches the fullScreen render snapshot', () => {
|
|
const { container } = render(<Loader fullScreen={true} />);
|
|
expect(container.firstChild).toMatchSnapshot();
|
|
});
|
|
});
|