Skip to content

Instantly share code, notes, and snippets.

@jmichelin
Last active April 20, 2017 13:47
Show Gist options
  • Save jmichelin/e0fc81be3e450bd94739b6cd39b3ed57 to your computer and use it in GitHub Desktop.
Save jmichelin/e0fc81be3e450bd94739b6cd39b3ed57 to your computer and use it in GitHub Desktop.
Basic test?
// .babelrc
{
"presets": ["es2015", "react"]
}
/**
* Created by jmichelin on 4/19/17.
*/
import React from 'react';
import expect from 'expect';
import {shallow} from 'enzyme';
import renderer from 'react-test-renderer';
import Login from '../link';
describe('Login (Snapshot)', () => {
it('Login renders the sign in screen', () => {
const component = renderer.create(<Login />);
const json = component.toJSON();
expect(json).toMatchSnapshot();
});
});
describe('Login', () => {
it('Login renders connect button', () => {
const login = shallow(<Login />);
expect(login.find('button').text()).toEqual('Connect with Spotify');
});
});
test('Login renders connect button', () => {
const login = shallow(<Login />);
expect(login.find('button').text()).toEqual('Connect with Spotify');
});
{
"name": "code-it",
"version": "1.0.0",
"description": "",
"main": "jp.js",
"scripts": {
"test": "jest"
},
"dependencies": {
"react": "15.5.4",
"react-dom": "15.5.4"
},
"devDependencies": {
"babel-jest": "19.0.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-react": "6.24.1",
"enzyme": "2.8.2",
"expect": "1.20.2",
"jest": "19.0.2",
"react-test-renderer": "15.5.4"
},
"author": "John Michelin <[email protected]> (http://www.javascriptjohn.com/)",
"license": "MIT"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment