From 948c7dc94ba01d53ea16d0812b3597a78b6e64e0 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Thu, 24 Jan 2019 14:59:40 -0500 Subject: [PATCH] include tests in eslinting --- package.json | 2 +- test/unit/Interval.test.js | 19 ++++++++++++++++++- test/unit/Tabs.test.js | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index a1a3e747b..09b56a35a 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "prepare": "npm run build:all", "publish-all": "node scripts/publish.js", "start": "webpack-serve ./webpack.serve.config.js --open", - "lint": "eslint src", + "lint": "eslint src test", "lint:py": "flake8 --ignore=E501,F401,F841,F811 test", "test": "run-s -c test-unit test:py test:pyimport lint format:test lint:py", "test:py": "python -m unittest test.test_integration", diff --git a/test/unit/Interval.test.js b/test/unit/Interval.test.js index 0122e8647..bb155db4b 100644 --- a/test/unit/Interval.test.js +++ b/test/unit/Interval.test.js @@ -1,5 +1,6 @@ import Interval from '../../src/components/Interval.react.js'; import React, {cloneElement, Component} from 'react'; +import PropTypes from 'prop-types'; import omit from 'lodash/omit'; import {mount, render} from 'enzyme'; @@ -40,6 +41,11 @@ class IntervalWrapper extends Component { } } +IntervalWrapper.propTypes = { + children: PropTypes.node, + setProps: PropTypes.func +}; + const intervalLength = 50; // The following number should be large enough for any @@ -127,11 +133,16 @@ describe('Delayed setProps provisioning', () => { ...omit(this.props, ['children']), setProps: this.state.setPropsProvided ? this.props.setProps - : undefined, + : null, }); } } + DelayedSetPropsWrapper.propTypes = { + children: PropTypes.node, + setProps: PropTypes.func + }; + const makeSut = () => { const results = { nIntervals: 0, @@ -222,6 +233,12 @@ describe('Usage of disabled = true', () => { } } + DisabledTestingIntervalWrapper.propTypes = { + children: PropTypes.node, + setProps: PropTypes.func, + handleInterval: PropTypes.func + }; + const makeSut = handleInterval => { const results = { nIntervals: 0, diff --git a/test/unit/Tabs.test.js b/test/unit/Tabs.test.js index 568c8f30e..c7e269cbd 100644 --- a/test/unit/Tabs.test.js +++ b/test/unit/Tabs.test.js @@ -1,7 +1,7 @@ import Tabs from '../../src/components/Tabs.react.js'; import Tab from '../../src/components/Tab.react.js'; import React from 'react'; -import {mount, shallow, render} from 'enzyme'; +import {mount, render} from 'enzyme'; test('Tabs render', () => { const tabs = render(