From 66a5cf08b6a2b8620f843b1e13e62dd043bd7445 Mon Sep 17 00:00:00 2001 From: schnogz Date: Fri, 8 Jun 2018 10:36:19 -0400 Subject: [PATCH] upgrade jest related dependencies and fix lint issues --- package.json | 12 +++++------ .../Form/FiatConvertor/Convertor/index.js | 14 ++++++------- .../Form/NumberBoxDebounced/index.js | 14 ++++++------- .../Form/TextAreaDebounced/index.js | 14 ++++++------- .../components/Form/TextBoxDebounced/index.js | 14 ++++++------- .../scenes/BuySell/BuySellAnimation/index.js | 20 +++++++++---------- .../TwoStepVerification/index.js | 15 +++++++------- 7 files changed, 52 insertions(+), 51 deletions(-) diff --git a/package.json b/package.json index 2877bbce86e..7b398ee945b 100644 --- a/package.json +++ b/package.json @@ -114,14 +114,14 @@ "file-loader": "^1.1.5", "html-webpack-plugin": "^3.0.7", "identity-obj-proxy": "^3.0.0", - "istanbul": "^0.4.4", + "istanbul": "^0.4.5", "istanbul-coveralls": "^1.0.3", - "jest": "^22.4.2", - "jest-cli": "^22.4.2", + "jest": "^23.1.0", + "jest-cli": "^23.1.0", "jest-css-modules": "^1.1.0", - "jest-fetch-mock": "^1.5.0", - "jest-styled-components": "^5.0.0", - "lerna": "^2.9.0", + "jest-fetch-mock": "^1.6.3", + "jest-styled-components": "^5.0.1", + "lerna": "^2.11.0", "mock-socket": "^7.1.0", "npm-watch": "^0.3.0", "react-hot-loader": "^4.0.1", diff --git a/packages/blockchain-wallet-v4-frontend/src/components/Form/FiatConvertor/Convertor/index.js b/packages/blockchain-wallet-v4-frontend/src/components/Form/FiatConvertor/Convertor/index.js index ec30da7f461..45402b81bc7 100644 --- a/packages/blockchain-wallet-v4-frontend/src/components/Form/FiatConvertor/Convertor/index.js +++ b/packages/blockchain-wallet-v4-frontend/src/components/Form/FiatConvertor/Convertor/index.js @@ -6,13 +6,6 @@ import { convertFiatToCoin, convertCoinToFiat } from './services' import Convertor from './template' class ConvertorContainer extends React.PureComponent { - static getDerivedStateFromProps (nextProps, prevState) { - if (!equals(nextProps.value, prevState)) { - return nextProps.value - } - return null - } - constructor (props) { super(props) this.state = { coin: '', fiat: '' } @@ -22,6 +15,13 @@ class ConvertorContainer extends React.PureComponent { this.handleFocus = this.handleFocus.bind(this) } + static getDerivedStateFromProps (nextProps, prevState) { + if (!equals(nextProps.value, prevState)) { + return nextProps.value + } + return null + } + handleCoinChange (e) { const { unit, currency, btcRates, bchRates, ethRates } = this.props const nextProps = convertCoinToFiat(e.target.value, unit, currency, bchRates, btcRates, ethRates) diff --git a/packages/blockchain-wallet-v4-frontend/src/components/Form/NumberBoxDebounced/index.js b/packages/blockchain-wallet-v4-frontend/src/components/Form/NumberBoxDebounced/index.js index 41306804d57..04a75e4f047 100644 --- a/packages/blockchain-wallet-v4-frontend/src/components/Form/NumberBoxDebounced/index.js +++ b/packages/blockchain-wallet-v4-frontend/src/components/Form/NumberBoxDebounced/index.js @@ -25,13 +25,6 @@ const getErrorState = (meta) => { } class NumberBoxDebounced extends React.Component { - static getDerivedStateFromProps (nextProps, prevState) { - if (!equals(nextProps.input.value, prevState)) { - return { value: nextProps.input.value } - } - return null - } - constructor (props) { super(props) this.state = { value: props.input.value } @@ -41,6 +34,13 @@ class NumberBoxDebounced extends React.Component { this.handleFocus = this.handleFocus.bind(this) } + static getDerivedStateFromProps (nextProps, prevState) { + if (!equals(nextProps.input.value, prevState)) { + return { value: nextProps.input.value } + } + return null + } + componentWillUnmount () { clearTimeout(this.timeout) } diff --git a/packages/blockchain-wallet-v4-frontend/src/components/Form/TextAreaDebounced/index.js b/packages/blockchain-wallet-v4-frontend/src/components/Form/TextAreaDebounced/index.js index 947b4ade7a1..da8dc292476 100644 --- a/packages/blockchain-wallet-v4-frontend/src/components/Form/TextAreaDebounced/index.js +++ b/packages/blockchain-wallet-v4-frontend/src/components/Form/TextAreaDebounced/index.js @@ -24,13 +24,6 @@ const getErrorState = (meta) => { } class TextAreaDebounced extends React.Component { - static getDerivedStateFromProps (nextProps, prevState) { - if (!equals(nextProps.input.value, prevState)) { - return { value: nextProps.input.value } - } - return null - } - constructor (props) { super(props) this.state = { value: props.input.value } @@ -40,6 +33,13 @@ class TextAreaDebounced extends React.Component { this.handleFocus = this.handleFocus.bind(this) } + static getDerivedStateFromProps (nextProps, prevState) { + if (!equals(nextProps.input.value, prevState)) { + return { value: nextProps.input.value } + } + return null + } + componentWillUnmount () { clearTimeout(this.timeout) } diff --git a/packages/blockchain-wallet-v4-frontend/src/components/Form/TextBoxDebounced/index.js b/packages/blockchain-wallet-v4-frontend/src/components/Form/TextBoxDebounced/index.js index 6f676191116..e80430e2498 100644 --- a/packages/blockchain-wallet-v4-frontend/src/components/Form/TextBoxDebounced/index.js +++ b/packages/blockchain-wallet-v4-frontend/src/components/Form/TextBoxDebounced/index.js @@ -25,13 +25,6 @@ const getErrorState = (meta) => { } class TextBoxDebounced extends React.Component { - static getDerivedStateFromProps (nextProps, prevState) { - if (!equals(nextProps.input.value, prevState)) { - return { value: nextProps.input.value } - } - return null - } - constructor (props) { super(props) this.state = { value: props.input.value } @@ -41,6 +34,13 @@ class TextBoxDebounced extends React.Component { this.handleFocus = this.handleFocus.bind(this) } + static getDerivedStateFromProps (nextProps, prevState) { + if (!equals(nextProps.input.value, prevState)) { + return { value: nextProps.input.value } + } + return null + } + componentWillUnmount () { clearTimeout(this.timeout) } diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/BuySell/BuySellAnimation/index.js b/packages/blockchain-wallet-v4-frontend/src/scenes/BuySell/BuySellAnimation/index.js index ed78571d4cd..0283e80cf4d 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/BuySell/BuySellAnimation/index.js +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/BuySell/BuySellAnimation/index.js @@ -64,6 +64,16 @@ const Eth = styled.div` ` class BuySellAnimation extends React.PureComponent { + constructor (props) { + super(props) + this.state = { + base: false, + btc: '', + bch: '', + eth: '' + } + } + static getDerivedStateFromProps (nextProps) { const sfoxCountries = nextProps.options.platforms.web.sfox.countries const unocoinCountries = nextProps.options.platforms.web.unocoin.countries @@ -101,16 +111,6 @@ class BuySellAnimation extends React.PureComponent { } } - constructor (props) { - super(props) - this.state = { - base: false, - btc: '', - bch: '', - eth: '' - } - } - componentDidMount () { setTimeout(() => this.setState({ base: true }), 1) } diff --git a/packages/blockchain-wallet-v4-frontend/src/scenes/SecurityCenter/TwoStepVerification/index.js b/packages/blockchain-wallet-v4-frontend/src/scenes/SecurityCenter/TwoStepVerification/index.js index 223b03bdae5..1619c808430 100644 --- a/packages/blockchain-wallet-v4-frontend/src/scenes/SecurityCenter/TwoStepVerification/index.js +++ b/packages/blockchain-wallet-v4-frontend/src/scenes/SecurityCenter/TwoStepVerification/index.js @@ -11,13 +11,6 @@ import Success from './template.success' import { formValueSelector } from 'redux-form' class TwoStepVerificationContainer extends React.PureComponent { - static getDerivedStateFromProps (nextProps, prevState) { - const data = nextProps.data.data - if (data.authType === 4) return { authName: 'Authenticator App' } - if (data.authType === 5) return { authName: 'SMS Codes' } - if (data.authType === 1 || data.authType === 2) return { authName: 'Yubikey' } - return prevState - } constructor (props) { super(props) @@ -30,6 +23,14 @@ class TwoStepVerificationContainer extends React.PureComponent { this.state = { authName: '', pulse: false } } + static getDerivedStateFromProps (nextProps, prevState) { + const data = nextProps.data.data + if (data.authType === 4) return { authName: 'Authenticator App' } + if (data.authType === 5) return { authName: 'SMS Codes' } + if (data.authType === 1 || data.authType === 2) return { authName: 'Yubikey' } + return prevState + } + componentDidUpdate (prevProps) { if (this.props.data.data.authType > 0 && prevProps.data.data.authType === 0) this.props.updateUI({ editing: true }) }