-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `test-bundler.js`, which sets up chai/chai-enzyme, and requires all tests. * Karma config: Only reference `test-bundler.js` instead of a glob. * Webpack test config: Removed cheerio from externals enzymejs/enzyme#47 (comment)
- Loading branch information
1 parent
f8d4e1b
commit 2971a85
Showing
5 changed files
with
26 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import Img from './index'; | ||
|
||
import expect from 'expect'; | ||
import { expect } from 'chai'; | ||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
describe('<Img />', () => { | ||
it('should render an <img> tag', () => { | ||
const renderedComponent = shallow(<Img src="test.png" alt="test" />); | ||
expect(renderedComponent.find('img').length).toEqual(1); | ||
expect(renderedComponent).to.have.tagName('img'); | ||
}); | ||
|
||
it('should have an alt attribute', () => { | ||
const renderedComponent = shallow(<Img src="test.png" alt="test" />); | ||
expect(renderedComponent.prop('alt')).toEqual('test'); | ||
expect(renderedComponent).to.have.attr('alt', 'test'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import sinon from 'sinon'; | ||
import chai from 'chai'; | ||
import chaiEnzyme from 'chai-enzyme'; | ||
|
||
chai.use(chaiEnzyme()); | ||
|
||
global.chai = chai; | ||
global.sinon = sinon; | ||
global.expect = chai.expect; | ||
global.should = chai.should(); | ||
|
||
const testsContext = require.context('../app', true, /\.test\.js$/); | ||
testsContext.keys().forEach(testsContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters