Skip to content

Instantly share code, notes, and snippets.

@ErrorPro
Created May 17, 2018 06:55
Show Gist options
  • Select an option

  • Save ErrorPro/c47150b599a7dbb1eba1ef5bb3abaa7b to your computer and use it in GitHub Desktop.

Select an option

Save ErrorPro/c47150b599a7dbb1eba1ef5bb3abaa7b to your computer and use it in GitHub Desktop.
import React from 'react';
import Button from './Button';
import renderer from 'react-test-renderer';
/* other tests */
test('renders with 0 as an initial state of counter', () => {
const component = renderer.create(
<Button onClick={() => {}} label="this is test label" />
);
const instance = component.getInstance();
expect(instance.state.counter).toBe(0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment