This file contains hidden or 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 React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
export class MyComponent extends Component {} | |
const mapStateToProps = state => { | |
return {} | |
} | |
const mapDispatchToProps = dispatch => { |
This file contains hidden or 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 React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
class MyComponent extends Component {} | |
const mapStateToProps = state => { | |
return {} | |
} | |
const mapDispatchToProps = dispatch => { |
This file contains hidden or 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 Counter from './Counter'; | |
it('state starts with a count of zero', () => { | |
const wrapper = shallow(<Counter />); | |
expect(wrapper.find('[data-test="count_result"]').text()).toEqual('Current Count: 0'); | |
}); | |
it('increment counter by one', () => { |
This file contains hidden or 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 React, { Component } from 'react'; | |
class Counter extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
count: 0 | |
} |
This file contains hidden or 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 Header from './Header'; | |
import logo from '../logo.svg'; | |
describe('Header Text', () => { | |
it('renders correctly', () => { | |
const wrapper = swallow( | |
<Header logo={logo} /> | |
); | |
expect(wrapper).toMatchSnapshot(); |
This file contains hidden or 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 Header from './Header'; | |
import logo from '../logo.svg'; | |
describe('Header Text', () => { | |
it('renders correctly', () => { | |
const wrapper = render( | |
<Header logo={logo} /> | |
); | |
expect(wrapper).toMatchSnapshot(); |
This file contains hidden or 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
npm install --save enzyme enzyme-adapter-react-16 react-test-renderer enzyme-to-json sinon |
This file contains hidden or 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 React from 'react'; | |
import Enzyme, { shallow, render, mount } from 'enzyme'; | |
import Adapter from 'enzyme-adapter-react-16'; | |
import { createSerializer } from 'enzyme-to-json'; | |
import sinon from 'sinon'; | |
expect.addSnapshotSerializer(createSerializer({mode: "deep"})); | |
//React 16 Enzyme adapter | |
Enzyme.configure({ adapter: new Adapter() }); |
This file contains hidden or 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
describe('Use to decribe the whole test that will take place', () => { | |
it('test for something', () => { | |
//this handle the test | |
}); | |
it('test another thing', () => { | |
//this handle the test | |
}); |
This file contains hidden or 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 React, { Component } from 'react'; | |
import './App.css'; | |
import TextInput from './TextInput'; | |
import validate from './validate'; | |
import TextArea from './TextArea'; | |
import Email from './Email'; | |
import Select from './Select'; | |
import Radio from './Radio'; |