Skip to content

Commit

Permalink
feat (jest) implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
grrseguin committed Jun 29, 2016
1 parent a307c3e commit b5be10e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
22 changes: 22 additions & 0 deletions __tests__/Title-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
jest.unmock('../src/components/Title');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import Title from '../src/components/Title';

describe('Title', () => {

it('changes the text after click', () => {
// Render a checkbox with label in the document
const title = TestUtils.renderIntoDocument(
<Title>Hello, world! I am a title.</Title>
);

const titleNode = ReactDOM.findDOMNode(title);

// Verify that it's Off by default
expect(titleNode.textContent).toEqual('Hello, world! I am a title.');
});

});
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,30 @@
},
"devDependencies": {
"babel-core": "^6.10.4",
"babel-jest": "^13.0.0",
"babel-loader": "^6.2.4",
"babel-polyfill": "^6.9.1",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"jest-cli": "^13.0.0",
"react-addons-test-utils": "^15.1.0",
"style-loader": "^0.13.1",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "jest",
"start": "webpack-dev-server"
},
"jest": {
"unmockedModulePathPatterns": [
"../node_modules/react/",
"../node_modules/react-dom/",
"../node_modules/react-addons-test-utils/"
]
},
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/grrseguin/jest-N-react-css-modules.git"
Expand Down

0 comments on commit b5be10e

Please sign in to comment.