Updating Footer to use react-testing-library

This commit is contained in:
Jeff Avallone 2019-03-24 13:04:06 -04:00
parent ced6c42c3d
commit 383197a4c1
2 changed files with 46 additions and 38 deletions

View File

@ -1,24 +1,31 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Footer rendering 1`] = ` exports[`Footer rendering 1`] = `
<DocumentFragment>
<footer <footer
className="footer" class="footer"
> >
<ul <ul
className="list" class="list"
> >
<li> <li>
<Trans> <span
data-component="Trans"
data-props="{}"
>
Created by Created by
<a <a
href="mailto:jeff.avallone@gmail.com" href="mailto:jeff.avallone@gmail.com"
> >
Jeff Avallone Jeff Avallone
</a> </a>
</Trans> </span>
</li> </li>
<li> <li>
<Trans> <span
data-component="Trans"
data-props="{}"
>
Generated images licensed: Generated images licensed:
<a <a
href="http://creativecommons.org/licenses/by/3.0/" href="http://creativecommons.org/licenses/by/3.0/"
@ -30,13 +37,14 @@ exports[`Footer rendering 1`] = `
src="cc-by.svg" src="cc-by.svg"
/> />
</a> </a>
</Trans> </span>
</li> </li>
</ul> </ul>
<div <div
className="buildId" class="buildId"
> >
abc-123 abc-123
</div> </div>
</footer> </footer>
</DocumentFragment>
`; `;

View File

@ -1,14 +1,14 @@
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { render } from 'react-testing-library';
import { mockT } from 'i18n'; import { mockT } from 'i18n';
import { Footer } from 'components/Footer'; import { Footer } from 'components/Footer';
describe('Footer', () => { describe('Footer', () => {
test('rendering', () => { test('rendering', () => {
const component = shallow( const { asFragment } = render(
<Footer buildId="abc-123" t={ mockT } /> <Footer buildId="abc-123" t={ mockT } />
); );
expect(component).toMatchSnapshot(); expect(asFragment()).toMatchSnapshot();
}); });
}); });