Skip to content

Instantly share code, notes, and snippets.

@DanielMSchmidt
Last active September 3, 2021 08:17
Show Gist options
  • Save DanielMSchmidt/3c236dbb268e0257152f73c7bb99d676 to your computer and use it in GitHub Desktop.
Save DanielMSchmidt/3c236dbb268e0257152f73c7bb99d676 to your computer and use it in GitHub Desktop.
A Jest snapshot test for an accordion
import React from 'react';
import renderer from 'react-test-renderer';
import Accordion from '../src/components/Accordion';
describe('Accordion', () => {
it('renders the additional content on hover', () => {
const component = renderer.create(
<Accordion activeIndex={1} headlines={['Foo', 'Bar', 'Baz']} content={['Foo Content', 'Bar content', 'Baz content']} />
);
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment