Updating Layout to use react-testing-library
This commit is contained in:
parent
383197a4c1
commit
ace907779f
@ -1,26 +1,30 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`Layout rendering 1`] = `
|
exports[`Layout rendering 1`] = `
|
||||||
<SentryBoundary>
|
<DocumentFragment>
|
||||||
<noscript>
|
<span
|
||||||
<style
|
data-component="SentryBoundary"
|
||||||
type="text/css"
|
data-props="{}"
|
||||||
>
|
>
|
||||||
|
<noscript />
|
||||||
[data-requires-js] {
|
<span
|
||||||
display: none !important;
|
data-component="withI18nextTranslation(Header)"
|
||||||
}
|
data-props="{
|
||||||
|
\\"banner\\": \\"Test Banner\\"
|
||||||
</style>
|
}"
|
||||||
</noscript>
|
|
||||||
<withI18nextTranslation(Header)
|
|
||||||
banner="Test Banner"
|
|
||||||
/>
|
/>
|
||||||
<SentryBoundary>
|
<span
|
||||||
|
data-component="SentryBoundary"
|
||||||
|
data-props="{}"
|
||||||
|
>
|
||||||
Example content
|
Example content
|
||||||
</SentryBoundary>
|
</span>
|
||||||
<withI18nextTranslation(Footer)
|
<span
|
||||||
buildId="test-buildid"
|
data-component="withI18nextTranslation(Footer)"
|
||||||
|
data-props="{
|
||||||
|
\\"buildId\\": \\"test-buildid\\"
|
||||||
|
}"
|
||||||
/>
|
/>
|
||||||
</SentryBoundary>
|
</span>
|
||||||
|
</DocumentFragment>
|
||||||
`;
|
`;
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
|
jest.mock('components/SentryBoundary', () =>
|
||||||
|
require('__mocks__/component-mock')('components/SentryBoundary'));
|
||||||
|
jest.mock('components/Header', () =>
|
||||||
|
require('__mocks__/component-mock')('components/Header'));
|
||||||
|
jest.mock('components/Footer', () =>
|
||||||
|
require('__mocks__/component-mock')('components/Footer'));
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { render } from 'react-testing-library';
|
||||||
|
|
||||||
import { Layout } from 'components/Layout';
|
import { Layout } from 'components/Layout';
|
||||||
|
|
||||||
describe('Layout', () => {
|
describe('Layout', () => {
|
||||||
test('rendering', () => {
|
test('rendering', () => {
|
||||||
const component = shallow(
|
const { asFragment } = render(
|
||||||
<Layout banner="Test Banner" buildId="test-buildid">
|
<Layout banner="Test Banner" buildId="test-buildid">
|
||||||
Example content
|
Example content
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
expect(component).toMatchSnapshot();
|
expect(asFragment()).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user