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,42 +1,50 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Footer rendering 1`] = ` exports[`Footer rendering 1`] = `
<footer <DocumentFragment>
className="footer" <footer
> class="footer"
<ul
className="list"
> >
<li> <ul
<Trans> class="list"
Created by >
<a <li>
href="mailto:jeff.avallone@gmail.com" <span
data-component="Trans"
data-props="{}"
> >
Jeff Avallone Created by
</a> <a
</Trans> href="mailto:jeff.avallone@gmail.com"
</li> >
<li> Jeff Avallone
<Trans> </a>
Generated images licensed: </span>
<a </li>
href="http://creativecommons.org/licenses/by/3.0/" <li>
rel="license external noopener noreferrer" <span
target="_blank" data-component="Trans"
data-props="{}"
> >
<img Generated images licensed:
alt="TRANSLATE(Creative Commons CC-BY-3.0 License)" <a
src="cc-by.svg" href="http://creativecommons.org/licenses/by/3.0/"
/> rel="license external noopener noreferrer"
</a> target="_blank"
</Trans> >
</li> <img
</ul> alt="TRANSLATE(Creative Commons CC-BY-3.0 License)"
<div src="cc-by.svg"
className="buildId" />
> </a>
abc-123 </span>
</div> </li>
</footer> </ul>
<div
class="buildId"
>
abc-123
</div>
</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();
}); });
}); });