Created
February 12, 2019 17:31
-
-
Save Ranguro/a14b6b8e6868ff508b80f29df8a99971 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Test Code */ | |
import React from 'react'; | |
import { shallow } from 'enzyme'; | |
import { createSerializer } from 'enzyme-to-json'; | |
// eslint-disable-next-line | |
import DummyComponent from '../component-dir/DummyComponent'; | |
// eslint-disable-next-line | |
// Uncomment this line and it removes the warning regarding to enzyme-adapter-react-15 | |
//expect.addSnapshotSerializer(createSerializer({ mode: 'deep' })); | |
function doShallow() { | |
const wrapper = shallow(<DummyComponent />); | |
return { wrapper }; | |
} | |
describe('<DummyComponent/> Component', () => { | |
it('Should compile', () => { | |
const { wrapper } = doShallow(); | |
expect(wrapper).toMatchSnapshot(); | |
console.log('Wrapper debug'); | |
console.log(wrapper.debug()); | |
}); | |
}); | |
/* Dummy Component Code */ | |
import React from 'react'; | |
const DummyComponent = () => { | |
const TestComponent = ( | |
<div id={'someId'}> | |
Test component | |
</div> | |
); | |
return ( | |
<article className='some-classname'> | |
{TestComponent} | |
</article> | |
); | |
}; | |
export default DummyComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment