import 'jest'; import * as React from 'react'; import * as renderer from 'react-test-renderer'; import BR, { BlueRainProvider } from '@blueeast/bluerain-os'; import { configure, shallow } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; configure({ adapter: new Adapter() }); import AppCard from '../AppCard'; BR.Components.set('View', () =>
View
); BR.Components.set('Text', () =>
Text
); BR.Components.set('Link', () =>
Link
); BR.Apps.getIconElement = jest.fn(); // it('renders correctly Card', () => { // const tree = renderer.create( // // // // ).toJSON(); // expect(tree).toMatchSnapshot(); // }); // test('AppCard renders correctly with size prop ', () => { // const wrapper = shallow( // // // // ); // const props: any = wrapper.instance().props; // expect(props.children.props.size).toEqual(100); // }); // it('renders correctly Card', () => { // const tree = renderer.create( // // // // ).toJSON(); // expect(tree).toMatchSnapshot(); // }); // test('AppCard renders with size & name', () => { // const wrapper = shallow( // // // // ); // const props: any = wrapper.instance().props; // expect(props.children.props.name).toEqual('Card1'); // expect(props.children.props.size).toEqual(160); // }); // it('AppCard renders correctly with size & name', () => { // const tree = renderer.create( // // // // ).toJSON(); // expect(tree).toMatchSnapshot(); // }); test('AppCard renders with size, name & link', () => { const wrapper = shallow( ); const props: any = wrapper.instance().props; expect(props.children.props.name).toEqual('Card1'); expect(props.children.props.size).toEqual(160); expect(props.children.props.link).toEqual('/'); }); it('AppCard renders correctly with size, name & link', () => { const tree = renderer.create( ).toJSON(); expect(tree).toMatchSnapshot(); }); test('AppCard renders with all props', () => { const wrapper = shallow( ); const props: any = wrapper.instance().props; expect(props.children.props.size).toEqual(160); expect(props.children.props.name).toEqual('Card1'); expect(props.children.props.link).toEqual('/'); expect(props.children.props.slug).toEqual('Hello'); }); it('AppCard renders correctly with all props', () => { const tree = renderer.create( ).toJSON(); expect(tree).toMatchSnapshot(); });