@retailmenot/anchor
Version:
A React UI Library by RetailMeNot
44 lines • 1.9 kB
JavaScript
// VENDOR
import * as React from 'react';
import * as renderer from 'react-test-renderer';
import { shallow, mount } from 'enzyme';
// COMPONENT
import { Adaptor } from './Adaptor.component';
import { ResponsiveProvider } from '../ResponsiveProvider';
describe('Component: Adaptor', () => {
it('should be defined', () => {
const subject = (React.createElement(ResponsiveProvider, null,
React.createElement(Adaptor, { from: "xs", to: "xl" }),
";"));
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 warn the user that they can't only provide the 'to' prop without 'from'", () => {
const subject = (React.createElement(ResponsiveProvider, null,
React.createElement(Adaptor, { to: "xl" }),
";"));
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 warn the user that if using 'from' and/or 'to' that they must use ResponsiveProvider.", () => {
const subject = (React.createElement(Adaptor, { from: "xs", to: "xl" }, "Test"));
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();
});
});
//# sourceMappingURL=Adaptor.component.spec.js.map