diff --git a/src/components/RavenBoundary.test.js b/src/components/RavenBoundary.test.js new file mode 100644 index 0000000..7761ce2 --- /dev/null +++ b/src/components/RavenBoundary.test.js @@ -0,0 +1,32 @@ +import React from 'react'; +import { shallow } from 'enzyme'; + +import RavenBoundary from './RavenBoundary'; + +const testError = { error: 'test error' }; +const testDetails = { details: 'test details' }; + +describe('RavenBoundary', () => { + test('rendering', () => { + const Child = () => Child; + const component = shallow( + + + + ); + expect(component).toMatchSnapshot(); + }); + + test('rendering (with error)', () => { + const Child = () => Child; + const component = shallow( + + + + ); + expect(component).toMatchSnapshot(); + component.instance().componentDidCatch(testError, testDetails); + component.update(); + expect(component).toMatchSnapshot(); + }); +}); diff --git a/src/components/__snapshots__/RavenBoundary.test.js.snap b/src/components/__snapshots__/RavenBoundary.test.js.snap new file mode 100644 index 0000000..bbbe7d8 --- /dev/null +++ b/src/components/__snapshots__/RavenBoundary.test.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`RavenBoundary rendering (with error) 1`] = ``; + +exports[`RavenBoundary rendering (with error) 2`] = ` + +`; + +exports[`RavenBoundary rendering 1`] = ``;