Commit 1bf9be4a authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH

added chai-enzyme & test setup working

parent b5deba22
......@@ -14,3 +14,4 @@
[options]
module.name_mapper='^@helpers' ->'<PROJECT_ROOT>/src/helpers'
module.name_mapper='^@store' ->'<PROJECT_ROOT>/src/store'
module.name_mapper='^@test' ->'<PROJECT_ROOT>/test'
......@@ -64,6 +64,7 @@
| babel-preset-env | Babel support for dynamic targeting via browserslist syntax | Lets Babel dynamically change what code it changes based on your configuration |
| babel-preset-react | Babel support for JSX, Flow types, and other react things | Lets Babel understand & process idiomatic React code |
| chai | Assertion library | Provides tools for `assert`ing things in tests |
| chai-enzyme | Enzyme integration into chai | Lets you use enzyme assertion/testing functionality in chai statements instead of complex enzyme queries |
| cross-env | Cross-environment variable support | Transforms environment variable definitions written in Linux format to the current platform |
| css-loader | Webpack CSS loader | Lets Webpack parse references to CSS files |
| enzyme-adapter-react-16 | Enzyme support for React 16 | |
......
......@@ -1925,6 +1925,15 @@
"type-detect": "4.0.3"
}
},
"chai-enzyme": {
"version": "1.0.0-beta.0",
"resolved": "https://registry.npmjs.org/chai-enzyme/-/chai-enzyme-1.0.0-beta.0.tgz",
"integrity": "sha512-b2XJjyW1PfnW5a5ZBBcZWZJUhq8CA1kpTyXLf4Nac+EaiTuIyYeYN0Ft0qYoW+clinusKDhvJygiVktjhvvFvg==",
"dev": true,
"requires": {
"html": "1.0.0"
}
},
"chain-function": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/chain-function/-/chain-function-1.0.0.tgz",
......@@ -4513,6 +4522,15 @@
"wbuf": "1.7.2"
}
},
"html": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/html/-/html-1.0.0.tgz",
"integrity": "sha1-pUT6nqVJK/s6LMqCEKEL57WvH2E=",
"dev": true,
"requires": {
"concat-stream": "1.6.0"
}
},
"html-comment-regex": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.1.tgz",
......@@ -11734,9 +11752,9 @@
"dev": true
},
"worker-loader": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-1.0.0.tgz",
"integrity": "sha512-dUwgs4Rdi1qG3VciM1+EPgAoO8m9USpCXxE3xmpWrnHJSMKGkzpCUNeYLjBRgYcSkf2A5xnXpR450Wqtu+pq0w==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-1.1.0.tgz",
"integrity": "sha512-W91q8Wi1JxbzFQZuLJlFK4x8UuWjKgeOX9IMMyng007K0UkP6I8lOejckoCWY61QmnJq2x9qZ/Viru+uF8g6nA==",
"dev": true,
"requires": {
"loader-utils": "1.1.0",
......
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import chai from 'chai';
import chaiEnzyme from 'chai-enzyme';
configure({ adapter: new Adapter() });
chai.use(chaiEnzyme());
function importAll (r) {
r.keys().forEach(r);
......
......@@ -4,7 +4,7 @@ import { expect } from 'chai';
import { mount } from 'enzyme';
import sinon from 'sinon';
import Foo from '../src/Foo.jsx';
import { spies } from './';
import { spies } from '@test';
describe('<Foo />', () => {
let wrapper;
......@@ -24,6 +24,7 @@ describe('<Foo />', () => {
expect(wrapper.props().bar).to.equal('baz');
wrapper.setProps({ bar: 'foo' });
expect(wrapper.props().bar).to.equal('foo');
expect(wrapper.first()).to.have.prop('bar', 'foo');
});
it('simulates click events', () => {
......
......@@ -74,6 +74,7 @@ module.exports = {
*/
'@store': resolve(__dirname, './src/store'),
'@helpers': resolve(__dirname, './src/helpers'),
'@test': resolve(__dirname, './test'),
}
},
devServer: {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment