Created
March 26, 2018 12:49
-
-
Save magsout/f77d5dc6fb5c997c47824f19b7f126f8 to your computer and use it in GitHub Desktop.
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
import "../../../../scripts/test-setup.js" | |
import React from "react"; | |
import renderer from "react-test-renderer"; | |
import sinon from "sinon"; | |
import {shallow} from "enzyme"; | |
import { BrowserRouter as Router } from "react-router-dom"; | |
import Header from "../"; | |
it("renders Header default correctly", () => { | |
const tree = renderer.create( | |
<Router><Header /></Router> | |
).toJSON(); | |
expect(tree).toMatchSnapshot(); | |
}); | |
it('Header click button', () => { | |
const onClick = sinon.spy(); | |
const wrapper = shallow(<Header onClick={onClick} />); | |
wrapper.find('button').simulate('click'); | |
expect(onClick.calledOnce).toEqual(true); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment