You need to find the StyledButton
in the Button
component before asserting the props
// Button.test.js
import React from 'react';
import { shallow } from 'enzyme';
import Button from '../../components/Button/Button';
import { StyledButton } from './styled'
describe('Component: Button', () => {
const minProps = {
text: '',
size: '',
};
it('renders a button in size of "small" with text in it', () => {
const wrapper = shallow(
<Button {...minProps} size="small" text="Join us" />
);
expect(wrapper.find(StyledButton).prop('size')).toBe('small');
expect(wrapper.find(StyledButton).prop('text')).toBe('Join us');
});
});