Skip to content

Commit b3acd4a

Browse files
author
Emmanouil Konstantinidis
committed
Init Jest tests
1 parent 799c1ee commit b3acd4a

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
npm-debug.log
33

44
build/
5+
coverage/
56
node_modules/
67
Gitify.app/
8+

package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
"dist": "rm -rf Gitify.app/ && electron-packager . Gitify --platform=darwin --arch=x64 --version=0.27.1 --icon=images/app-icon.icns --prune --ignore=src",
1313
"test": "jsxhint --reporter node_modules/jshint-stylish/stylish.js 'src/**/*.js', 'index.js' --exclude 'Gruntfile.js' && jscs 'src/js/' && jest"
1414
},
15+
"jshintConfig": {
16+
"browserify": true,
17+
"unused": true,
18+
"undef": true,
19+
"globals": {
20+
"console": false
21+
}
22+
},
1523
"jscsConfig": {
1624
"esprima": "esprima-fb",
1725
"disallowMultipleVarDecl": "exceptUndefined",
@@ -50,6 +58,27 @@
5058
"requireSpaceBeforeObjectValues": true,
5159
"requireSpacesInForStatement": true
5260
},
61+
"jest": {
62+
"scriptPreprocessor": "src/js/__tests__/preprocessor.js",
63+
"collectCoverage": true,
64+
"collectCoverageOnlyFrom": {
65+
"src/js/actions/actions.js": true,
66+
"src/js/components/footer.js": true
67+
},
68+
"unmockedModulePathPatterns": [
69+
"node_modules/react",
70+
"node_modules/react-tools",
71+
"node_modules/underscore"
72+
],
73+
"testPathDirs": [
74+
"src/js/__tests__/"
75+
],
76+
"testPathIgnorePatterns": [
77+
"src/js/__tests__/preprocessor.js",
78+
"src/js/__tests__/__mocks__/",
79+
"node_modules/"
80+
]
81+
},
5382
"repository": {
5483
"type": "git",
5584
"url": "https://github.com/ekonstantinidis/gitify.git"
@@ -73,6 +102,7 @@
73102
"font-awesome": "=4.3.0",
74103
"octicons": "=2.2.0",
75104
"react": "=0.13.3",
105+
"react-tools": "=0.13.3",
76106
"react-router": "=0.13.3",
77107
"reactify": "=1.1.1",
78108
"reflux": "=0.2.7",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* global jest, describe, beforeEach, it, expect */
2+
3+
jest.dontMock('reflux');
4+
jest.dontMock('../../actions/actions.js');
5+
jest.dontMock('../../components/footer.js');
6+
7+
var React = require('react/addons');
8+
var TestUtils = React.addons.TestUtils;
9+
10+
describe('Test for Footer', function () {
11+
12+
var Actions, Footer;
13+
14+
beforeEach(function () {
15+
Actions = require('../../actions/actions.js');
16+
Footer = require('../../components/footer.js');
17+
});
18+
19+
it('Should load the footer', function () {
20+
21+
var instance = TestUtils.renderIntoDocument(<Footer />);
22+
23+
console.log(instance);
24+
25+
});
26+
27+
});

src/js/__tests__/preprocessor.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
var ReactTools = require('react-tools');
4+
5+
module.exports = {
6+
process: function (src) {
7+
return ReactTools.transform(src);
8+
}
9+
};

0 commit comments

Comments
 (0)