Last active
April 18, 2020 08:12
-
-
Save Lelith/19089b956cc934a1de8bb6e8847a9323 to your computer and use it in GitHub Desktop.
Snapshot Tesz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* src/components/Counter/test/Counter.test.js */ | |
import React from 'react' | |
import Counter from '../'; | |
import { shallow } from 'enzyme'; | |
import toJson from 'enzyme-to-json' | |
const callBackFunc = jest.fn(); | |
const counterComponent = shallow(<Counter callBack = {callBackFunc} />); | |
describe('<counterComponent />', () => { | |
(...) | |
it('turns red on negative amounts', () => { | |
counterComponent.setState({amount:-2}); | |
expect(toJson(counterComponent)).toMatchSnapshot(); | |
expect(counterComponent.find("[data-test='counterComponent']") | |
.first().hasClass('counter--negative')).toBe(true); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment