Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"presets": ["react-hmre"]
},
"test": {
"presets": ["react", "es2015"],
"presets": ["env" ,"react", "es2015"],
"plugins": [
[ "babel-plugin-webpack-alias", { "config": "${PWD}/webpack.config.js" } ]
]
Expand Down
7 changes: 7 additions & 0 deletions __mocks__/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
require: jest.genMockFunction(),
match: jest.genMockFunction(),
app: jest.genMockFunction(),
remote: jest.genMockFunction(),
dialog: jest.genMockFunction()
}
19 changes: 18 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"webpack": "webpack-dev-server --hot --inline --config webpack.config.js",
"compile": "grunt compile",
"test": "PWD=$(pwd) NODE_ENV=test ava --serial",
"jest": "jest",
"fix": "npm run lint --fix",
"lint": "eslint .",
"dev-start": "concurrently --kill-others \"npm run webpack\" \"npm run hot\""
Expand Down Expand Up @@ -96,11 +97,13 @@
"devDependencies": {
"ava": "^0.25.0",
"babel-core": "^6.14.0",
"babel-jest": "^22.4.3",
"babel-loader": "^6.2.0",
"babel-plugin-react-transform": "^2.0.0",
"babel-plugin-webpack-alias": "^2.1.1",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-react": "^6.24.1",
"babel-preset-react-hmre": "^1.0.1",
"babel-register": "^6.11.6",
"browser-env": "^3.2.5",
Expand All @@ -120,6 +123,9 @@
"grunt": "^0.4.5",
"grunt-electron-installer": "2.1.0",
"history": "^1.17.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^22.4.3",
"jest-localstorage-mock": "^2.2.0",
"jsdom": "^9.4.2",
"json-loader": "^0.5.4",
"merge-stream": "^1.0.0",
Expand All @@ -130,6 +136,7 @@
"react-input-autosize": "^1.1.0",
"react-router": "^2.4.0",
"react-router-redux": "^4.0.4",
"react-test-renderer": "^15.6.2",
"standard": "^8.4.0",
"style-loader": "^0.12.4",
"stylus": "^0.52.4",
Expand All @@ -152,5 +159,15 @@
"./tests/helpers/setup-electron-mock.js"
],
"babel": "inherit"
},
"jest": {
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less|styl)$": "identity-obj-proxy"
},
"setupFiles": [
"<rootDir>/tests/jest.js",
"jest-localstorage-mock"
]
}
}
9 changes: 9 additions & 0 deletions tests/components/TagListItem.snapshot.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import renderer from 'react-test-renderer'
import TagListItem from 'browser/components/TagListItem'

it('TagListItem renders correctly', () => {
const tagListItem = renderer.create(<TagListItem name='Test' handleClickTagListItem={jest.fn()} />)

expect(tagListItem.toJSON()).toMatchSnapshot()
})
19 changes: 19 additions & 0 deletions tests/components/__snapshots__/TagListItem.snapshot.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`TagListItem renders correctly 1`] = `
<button
className="tagList-item"
onClick={[Function]}
>
<span
className="tagList-item-name"
>
# Test
<span
className="tagList-item-count"
>

</span>
</span>
</button>
`;
12 changes: 12 additions & 0 deletions tests/jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Here you can mock the libraries connected through direct insertion <script src="" >
global.Raphael = {
setWindow: jest.fn(),
registerFont: jest.fn(),
fn: function () {
return {}
}
}

global._ = {
extend: jest.genMockFunction()
}
Loading