Skip to content

Commit 3e912bf

Browse files
committedOct 8, 2017
#9 started to use enzyme, not working yet.
1 parent 2b0dd28 commit 3e912bf

File tree

6 files changed

+69
-36
lines changed

6 files changed

+69
-36
lines changed
 

‎cfg/dev.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var config = {
1515
rules: [
1616
{
1717
test: /\.(js|jsx)$/,
18-
use: ['react-hot-loader', 'babel-loader'],
18+
use: ['babel-loader'],
1919
include: path.join(__dirname, '/../src')
2020
}
2121
]

‎cfg/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
// },
1919
{
2020
test: /\.(js|jsx)$/,
21-
loader: 'babel-loader',
21+
use: ['babel-loader'],
2222
include: [
2323
path.join(__dirname, '/../src'),
2424
path.join(__dirname, '/../test')

‎package-lock.json

+51-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"karma-mocha": "^0.2.0",
6666
"karma-mocha-reporter": "^1.1.1",
6767
"karma-sourcemap-loader": "^0.3.5",
68-
"karma-webpack": "^1.7.0",
68+
"karma-webpack": "^2.0.4",
6969
"less": "^2.5.3",
7070
"less-loader": "^2.0.0",
7171
"lodash": "^4.14.0",
@@ -84,7 +84,6 @@
8484
"react": "^16.0.0",
8585
"react-dom": "^16.0.0",
8686
"react-global": "^0.1.8",
87-
"react-hot-loader": "^1.2.9",
8887
"react-test-renderer": "^16.0.0",
8988
"react-widgets": "^3.5.0",
9089
"rimraf": "^2.6.2",

‎test/components/AppTest.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
// import React from 'react/addons';
88
// const TestUtils = React.addons.TestUtils;
99
import createComponent from 'helpers/shallowRenderHelper'
10-
10+
import { shallow, mount } from 'enzyme'
1111
import Main from 'components/app'
12+
import React from 'react'
1213

1314
describe('MainComponent', () => {
1415
let MainComponent
@@ -22,3 +23,11 @@ describe('MainComponent', () => {
2223
expect(MainComponent.props.className).to.equal('sp-main-container')
2324
})
2425
})
26+
27+
describe('<Main />', () => {
28+
it.only('should have its component name as default className', () => {
29+
debugger
30+
const wrapper = mount(<Main />)
31+
expect(wrapper.is('.sp-main-container')).to.equal(true)
32+
})
33+
})

‎test/loadtests.js

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
'use strict'
22

3+
// setup enzyme
4+
import { configure } from 'enzyme'
5+
import Adapter from 'enzyme-adapter-react-16'
6+
configure({ adapter: new Adapter() })
7+
38
// Add support for all files in the test directory
49
const testsContext = require.context('.', true, /(Test\.js$)|(Helper\.js$)/)
510
testsContext.keys().forEach(testsContext)

0 commit comments

Comments
 (0)
Please sign in to comment.