Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react'
- import { mount } from 'enzyme'
- import faker from 'faker'
- import 'jest-styled-components'
- import { MapPreviewImage } from './MapPreviewImage'
- describe('Today I want to test styled-components', () => {
- it('have MapPreviewImage styledcomponent', () => {
- const src = faker.image.avatar()
- const ratio = 1.55
- const styledProps = { ratio, src }
- const wrapper = mount(<MapPreviewImage {...styledProps} />)
- expect(wrapper).toHaveStyleRule('background-image', `url(${src})`)
- expect(wrapper).toHaveStyleRule('padding-top', `${100 / ratio}%`)
- })
- })
Add Comment
Please, Sign In to add comment