import React from 'react';
import { shallow, mount } from 'enzyme';
import Credit, { CreditBody } from '.';
import 'jest-styled-components';
describe('StoryCreditShare component', () => {
test('renders', () => {
const wrapper = shallow();
expect(wrapper).toMatchSnapshot();
});
test('it applies default styles', () => {
const wrapper = mount();
expect(wrapper).toHaveStyleRule('border-top', '1px solid #DDDDDD');
expect(wrapper).toHaveStyleRule('border-bottom', '1px solid #DDDDDD');
expect(wrapper).toHaveStyleRule('padding-top', '32px');
expect(wrapper).toHaveStyleRule('padding-bottom', '32px');
});
test('it has two child Body Components', () => {
const wrapper = mount();
const Body = wrapper.find(CreditBody);
expect(Body).toHaveLength(2);
});
test('the text of Words By is equal to `Words By Foo`', () => {
const wrapper = mount();
const Body = wrapper.find(CreditBody).first();
expect(Body.text()).toEqual('Words By Foo');
});
test('the text of Photography By is equal to `Photography By Foo`', () => {
const wrapper = mount();
const Body = wrapper.find(CreditBody).first();
expect(Body.text()).toEqual('Photography By Foo');
});
test('the text of Video By is equal to `Video By Foo`', () => {
const wrapper = mount();
const Body = wrapper.find(CreditBody).first();
expect(Body.text()).toEqual('Video By Foo');
});
test('when all props are passed the text is equal to `Words by Foo, Photography by Foo, Video by Foo`', () => {
const wrapper = mount();
const Author = wrapper.find(CreditBody).at(0);
const Photo = wrapper.find(CreditBody).at(1);
const Video = wrapper.find(CreditBody).at(2);
expect(Author.text()).toEqual('Words By Foo');
expect(Photo.text()).toEqual('Photography By Foo');
expect(Video.text()).toEqual('Video By Foo');
});
});