Fix test failures and warnings
This commit is contained in:
Родитель
3147c4d1b4
Коммит
2770df1d12
|
@ -21,6 +21,7 @@
|
|||
"d3-selection": "^1.0.2",
|
||||
"d3-shape": "^1.0.3",
|
||||
"enzyme": "^3.0.0",
|
||||
"enzyme-adapter-react-16": "^1.0.3",
|
||||
"eslint-plugin-react": "^7.3.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-autoprefixer": "^4.0.0",
|
||||
|
@ -30,7 +31,7 @@
|
|||
"gulp-jest": "^3.0.0",
|
||||
"gulp-sourcemaps": "^2.1.1",
|
||||
"gulp-stylus": "^2.3.1",
|
||||
"jest-cli": "^21.1.0",
|
||||
"jest-cli": "^21.3.0-beta.2",
|
||||
"nib": "^1.1.0",
|
||||
"nl2br": "0.0.3",
|
||||
"react": "^16.0.0",
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import React from 'react';
|
||||
import Enzyme from 'enzyme';
|
||||
import Adapter from 'enzyme-adapter-react-16';
|
||||
import sinon from 'sinon';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import Configuration from '../components/views/configuration';
|
||||
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
let outliersSpy, scaleSpy, configurationMock;
|
||||
|
||||
describe('Configuration', () => {
|
||||
|
@ -12,7 +14,7 @@ describe('Configuration', () => {
|
|||
outliersSpy = sinon.spy();
|
||||
scaleSpy = sinon.spy();
|
||||
|
||||
configurationMock = shallow(
|
||||
configurationMock = Enzyme.shallow(
|
||||
<Configuration
|
||||
whitelistedPopulations={['All']}
|
||||
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
import React from 'react';
|
||||
import { render } from 'enzyme';
|
||||
import Enzyme from 'enzyme';
|
||||
import Adapter from 'enzyme-adapter-react-16';
|
||||
|
||||
import DescriptionContainer from '../components/containers/description-container';
|
||||
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
||||
describe('DescriptionContainer', () => {
|
||||
it('All tags should be stripped from description before display', () => {
|
||||
const description = '<script src="http://example.com/example.js"></script>word1 <b>word2</b> <blockquote>word3</blockquote><br>';
|
||||
const dc = render(<DescriptionContainer rawDescription={description} />);
|
||||
const dc = Enzyme.mount(<DescriptionContainer rawDescription={description} />);
|
||||
const descriptionElm = dc.find('.description');
|
||||
expect(descriptionElm.text()).toBe('word1 word2 word3');
|
||||
expect(descriptionElm.html()).toContain('word1 word2 word3');
|
||||
});
|
||||
|
||||
it('Line breaks should be converted to <br> elements in description', () => {
|
||||
const description = 'Mozilla\nbuilds\n\nthe\rFirefox\nbrowser';
|
||||
const dc = render(<DescriptionContainer rawDescription={description} />);
|
||||
const dc = Enzyme.mount(<DescriptionContainer rawDescription={description} />);
|
||||
const descriptionElm = dc.find('.description');
|
||||
expect(descriptionElm.html()).toBe('Mozilla<br>\nbuilds<br>\n<br>\nthe<br>\rFirefox<br>\nbrowser');
|
||||
expect(descriptionElm.html()).toContain('Mozilla<br>\nbuilds<br>\n<br>\nthe<br>\nFirefox<br>\nbrowser');
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче