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

View File

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