Skip to content

Commit

Permalink
Use enzyme for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
frostney committed Feb 29, 2016
1 parent 4810bf5 commit 57c117d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
12 changes: 8 additions & 4 deletions karma.conf.js
Expand Up @@ -14,16 +14,20 @@ module.exports = function karma(config) {
devtool: 'eval',
module: {
preLoaders: [{
test: /\.js$/,
loader: 'babel-istanbul-loader',
test: /\.jsx?$/,
loader: 'babel-istanbul',
exclude: /(node_modules|test)/,
}, {
test: /\.js$/,
loader: 'babel-loader',
test: /\.jsx?$/,
loader: 'babel',
exclude: /(node_modules|src)/,
}, {
test: /\.json$/,
loader: 'json'
}],
},
resolve: {
extensions: ['', '.js', '.json'],
alias: {
'react-background-video': path.join(process.cwd(), 'src'),
},
Expand Down
6 changes: 5 additions & 1 deletion package.json
Expand Up @@ -29,7 +29,7 @@
"homepage": "https://github.com/BinaryThumb/react-background-video#readme",
"dependencies": {
"classnames": "^2.2.1",
"react": "^0.14.6"
"react": "^0.14.7"
},
"devDependencies": {
"babel-cli": "^6.2.0",
Expand All @@ -42,9 +42,11 @@
"babel-preset-stage-1": "^6.1.18",
"chai": "^3.4.1",
"coveralls": "^2.11.4",
"enzyme": "^2.0.0",
"eslint": "^1.10.2",
"eslint-config-airbnb": "^3.1.0",
"eslint-plugin-react": "^3.11.1",
"json-loader": "^0.5.4",
"karma": "^0.13.15",
"karma-chai": "^0.1.0",
"karma-coverage": "^0.5.3",
Expand All @@ -56,6 +58,8 @@
"loader-utils": "^0.2.12",
"mocha": "^2.3.4",
"phantomjs": "^1.9.19",
"react-addons-test-utils": "^0.14.7",
"react-dom": "^0.14.7",
"webpack": "^1.12.9"
}
}
17 changes: 5 additions & 12 deletions test/index.js
Expand Up @@ -2,18 +2,11 @@ import React from 'react';
import { expect } from 'chai';
import BackgroundVideo from 'react-background-video';

describe('BackgroundVideo', function () {
let component = null;
import { render } from 'enzyme';

beforeEach(function () {
const container = document.createElement('container');
container.id = 'content';
document.body.appendChild(container);

component = React.createElement(BackgroundVideo);
});

it('should create a new instance of BackgroundVideo', function () {
expect(component).to.be.ok;
describe('<BackgroundVideo />', () => {
it('is instantiable', () => {
const wrapper = render(<BackgroundVideo />);
expect(wrapper).to.not.equal(null);
});
});

0 comments on commit 57c117d

Please sign in to comment.