UNPKG

react-native-komect-uikit

Version:
67 lines (58 loc) 1.9 kB
import React from 'react'; import { shallow } from 'enzyme'; import toJson from 'enzyme-to-json'; import Card from '../Card'; describe('Card Component', () => { it('should render without issues', () => { const component = shallow(<Card />); expect(component.length).toBe(1); expect(toJson(component)).toMatchSnapshot(); }); it('should have Card title without image', () => { const component = shallow( <Card title="Card Title" containerStyle={{ backgroundColor: 'red' }} fontFamily="arial" dividerStyle={{ backgroundColor: 'red' }} flexDirection="row" /> ); expect(component.length).toBe(1); expect(toJson(component)).toMatchSnapshot(); }); it('should have Card title with image', () => { const component = shallow( <Card title="HELLO WORLD" image={{ uri: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg', }} containerStyle={{ backgroundColor: 'red' }} titleStyle={{ backgroundColor: 'red' }} fontFamily="arial" /> ); expect(component.length).toBe(1); expect(toJson(component)).toMatchSnapshot(); }); it('should have Card with featured title', () => { const component = shallow( <Card title="foo title" image={{ uri: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg', }} imageWrapperStyle={{ backgroundColor: 'red' }} imageStyle={{ backgroundColor: 'red' }} wrapperStyle={{ backgroundColor: 'red' }} featuredTitle="featured title" featuredSubtitle="featured sub title" featuredTitleStyle={{ backgroundColor: 'red' }} featuredSubtitleStyle={{ backgroundColor: 'red' }} /> ); expect(component.length).toBe(1); expect(toJson(component)).toMatchSnapshot(); }); });