UNPKG

@retailmenot/anchor

Version:

A React UI Library by RetailMeNot

40 lines 1.84 kB
// VENDOR import * as React from 'react'; import * as renderer from 'react-test-renderer'; import { ThemeProvider } from '@xstyled/styled-components'; import { shallow, mount } from 'enzyme'; // ANCHOR import { RootTheme } from '../../src/theme'; import { Pagination } from './Pagination.component'; describe('Component: Pagination', () => { it('should be defined.', () => { const subject = (React.createElement(ThemeProvider, { theme: RootTheme }, React.createElement(Pagination, { totalPages: 5 }))); const wrapper = mount(subject); const component = shallow(subject); expect(subject).toBeDefined(); expect(wrapper).toBeDefined(); expect(component).toBeDefined(); const tree = renderer.create(subject).toJSON(); expect(tree).toMatchSnapshot(); }); it('should render with many pages.', () => { const subject = (React.createElement(ThemeProvider, { theme: RootTheme }, React.createElement(Pagination, { totalPages: 100 }))); const tree = renderer.create(subject).toJSON(); expect(tree).toMatchSnapshot(); }); it('should render with current page in the middle.', () => { const subject = (React.createElement(ThemeProvider, { theme: RootTheme }, React.createElement(Pagination, { totalPages: 20, current: 10 }))); const tree = renderer.create(subject).toJSON(); expect(tree).toMatchSnapshot(); }); it('should render on the last page.', () => { const subject = (React.createElement(ThemeProvider, { theme: RootTheme }, React.createElement(Pagination, { totalPages: 20, current: 20 }))); const tree = renderer.create(subject).toJSON(); expect(tree).toMatchSnapshot(); }); }); //# sourceMappingURL=Pagination.component.spec.js.map