add snapshot tests for 'import-from-source' part

This commit is contained in:
GotPPay
2018-04-04 01:09:29 +02:00
parent ecb06fd4e2
commit 4d2cf52e4c
10 changed files with 1260 additions and 37 deletions

View File

@@ -6,10 +6,21 @@ it('renders without crashing', () => {
shallow(<Modal />);
});
let actionButton;
let childButton;
let wrapper;
beforeEach(()=>{
actionButton = <button key={0}>Dummy action button</button>;
childButton = <button key={1}>Child button</button>;
wrapper = mount(<Modal title={'Dummy title'} actions={[actionButton]}>{childButton}</Modal>);
});
it ('snapshot', () => {
expect(wrapper).toMatchSnapshot();
});
it('receives props as expected', () =>{
const actionButton = <button key={0}>Dummy action button</button>;
const childButton = <button key={1}>Child button</button>;
const wrapper = mount(<Modal title={'Dummy title'} actions={[actionButton]}>{childButton}</Modal>);
expect(wrapper.props().title).toEqual('Dummy title');
expect(wrapper.props().actions).toEqual([actionButton]);
expect(wrapper.props().children).toEqual(childButton);