Updating tests for Loader to use react-testing-library

This commit is contained in:
Jeff Avallone 2019-03-24 13:07:39 -04:00
parent ace907779f
commit 092fd39da6
2 changed files with 66 additions and 73 deletions

View File

@ -1,23 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Loader rendering 1`] = `
<Loader
t={[Function]}
>
<DocumentFragment>
<div
className="loader"
>
<Loader
color="currentColor"
size="24"
class="loader"
>
<svg
fill="none"
height="24"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
@ -71,12 +65,11 @@ exports[`Loader rendering 1`] = `
y2="4.93"
/>
</svg>
</Loader>
<div
className="message"
class="message"
>
TRANSLATE(Loading...)
</div>
</div>
</Loader>
</DocumentFragment>
`;

View File

@ -1,5 +1,5 @@
import React from 'react';
import { mount } from 'enzyme';
import { render } from 'react-testing-library';
import { mockT } from 'i18n';
import { Loader } from 'components/Loader';
@ -8,9 +8,9 @@ describe('Loader', () => {
test('rendering', () => {
// Using full rendering here since styles for this depend on the structure
// of the SVG.
const component = mount(
const { asFragment } = render(
<Loader t={ mockT } />
);
expect(component).toMatchSnapshot();
expect(asFragment()).toMatchSnapshot();
});
});