Browse Source

fix(tests): update the tests

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
b0d5ff90c0
  1. 7
      app/components/Form/Pay.js
  2. 40
      test/components/Form.spec.js
  3. 32
      test/components/Form/Pay.spec.js
  4. 15
      test/components/Form/Request.spec.js
  5. 70
      test/reducers/__snapshots__/ticker.spec.js.snap

7
app/components/Form/Pay.js

@ -63,7 +63,7 @@ class Pay extends Component {
if (node && node.alias.length) { return node.alias }
return pubkey.substring(0, 10)
return pubkey ? pubkey.substring(0, 10) : ''
}
const onCurrencyFilterClick = (currency) => {
@ -86,7 +86,7 @@ class Pay extends Component {
<div className={styles.content}>
<section className={styles.destination}>
<div className={styles.top}>
<label htmlFor='destination'>Destination</label>
<label htmlFor='paymentRequest'>Destination</label>
<span className={`${styles.description} ${(isOnchain || isLn) && styles.active}`}>
{isOnchain &&
<i>
@ -110,7 +110,7 @@ class Pay extends Component {
value={payInput}
onChange={event => setPayInput(event.target.value)}
onBlur={onPayInputBlur}
id='destination'
id='paymentRequest'
rows='2'
/>
<section className={`${styles.errorMessage} ${showErrors.payInput && styles.active}`}>
@ -180,6 +180,7 @@ Pay.propTypes = {
PropTypes.number
]),
payInput: PropTypes.string.isRequired,
invoice: PropTypes.object.isRequired,
showErrors: PropTypes.object.isRequired
}).isRequired,
currencyName: PropTypes.string.isRequired,

40
test/components/Form.spec.js

@ -7,40 +7,52 @@ import Request from '../../app/components/Form/Request'
const payFormProps = {
payform: {
amount: '',
amount: 0,
payInput: '',
invoice: {},
showErrors: {}
},
currency: 'BTC',
crypto: 'BTC',
currency: {},
crypto: {},
nodes: [],
ticker: {},
isOnchain: false,
isLn: false,
currentAmount: '0',
isLn: true,
currentAmount: 0,
usdAmount: 0,
inputCaption: '',
showPayLoadingScreen: false,
showPayLoadingScreen: true,
payFormIsValid: {},
currentCurrencyFilters: [],
currencyName: '',
setPayAmount: () => {},
onPayAmountBlur: () => {},
setPayInput: () => {},
onPayInputBlur: () => {},
setCurrencyFilters: () => {},
fetchInvoice: () => {},
setCurrency: () => {},
onPayAmountBlur: () => {},
onPayInputBlur: () => {},
onPaySubmit: () => {}
}
const requestFormProps = {
requestform: {
amount: '',
memo: ''
},
currency: '',
crypto: '',
requestform: {},
ticker: {},
currentCurrencyFilters: [],
showCurrencyFilters: true,
currencyName: '',
requestUsdAmount: '',
setRequestAmount: () => {},
setRequestMemo: () => {},
setCurrency: () => {},
setRequestCurrencyFilters: () => {},
onRequestSubmit: () => {}
}

32
test/components/Form/Pay.spec.js

@ -5,25 +5,35 @@ import Pay from '../../../app/components/Form/Pay'
const defaultProps = {
payform: {
amount: '',
amount: 0,
payInput: '',
invoice: {},
showErrors: {}
},
currency: 'BTC',
crypto: 'BTC',
currency: {},
crypto: {},
nodes: [],
ticker: {},
isOnchain: false,
isLn: false,
currentAmount: '0',
isLn: true,
currentAmount: 0,
usdAmount: 0,
inputCaption: '',
showPayLoadingScreen: false,
showPayLoadingScreen: true,
payFormIsValid: {},
currentCurrencyFilters: [],
currencyName: '',
setPayAmount: () => {},
onPayAmountBlur: () => {},
setPayInput: () => {},
onPayInputBlur: () => {},
setCurrencyFilters: () => {},
fetchInvoice: () => {},
setCurrency: () => {},
onPayAmountBlur: () => {},
onPayInputBlur: () => {},
onPaySubmit: () => {}
}
@ -34,8 +44,6 @@ describe('Form', () => {
it('should contain Pay', () => {
expect(el.find('input#paymentRequest').props.value).toBe(undefined)
expect(el.contains('lightning network')).toBe(false)
expect(el.contains('on-chain')).toBe(false)
})
})
@ -45,8 +53,6 @@ describe('Form', () => {
it('should contain Pay', () => {
expect(el.find('input#paymentRequest').props.value).toBe(undefined)
expect(el.contains('lightning network')).toBe(true)
expect(el.contains('on-chain')).toBe(false)
})
})
@ -56,8 +62,6 @@ describe('Form', () => {
it('should contain Pay', () => {
expect(el.find('input#paymentRequest').props.value).toBe(undefined)
expect(el.contains('lightning network')).toBe(false)
expect(el.contains('on-chain')).toBe(true)
})
})
})

15
test/components/Form/Request.spec.js

@ -4,15 +4,18 @@ import { shallow } from 'enzyme'
import Request from '../../../app/components/Form/Request'
const defaultProps = {
requestform: {
amount: '',
showErrors: {}
},
currency: '',
crypto: '',
requestform: {},
ticker: {},
currentCurrencyFilters: [],
showCurrencyFilters: true,
currencyName: '',
requestUsdAmount: '',
setRequestAmount: () => {},
setRequestMemo: () => {},
setCurrency: () => {},
setRequestCurrencyFilters: () => {},
onRequestSubmit: () => {}
}

70
test/reducers/__snapshots__/ticker.spec.js.snap

@ -5,6 +5,20 @@ Object {
"btcTicker": null,
"crypto": "",
"currency": "",
"currencyFilters": Array [
Object {
"key": "btc",
"name": "BTC",
},
Object {
"key": "bits",
"name": "bits",
},
Object {
"key": "sats",
"name": "satoshis",
},
],
"ltcTicker": null,
"tickerLoading": true,
}
@ -15,6 +29,20 @@ Object {
"btcTicker": undefined,
"crypto": "",
"currency": "",
"currencyFilters": Array [
Object {
"key": "btc",
"name": "BTC",
},
Object {
"key": "bits",
"name": "bits",
},
Object {
"key": "sats",
"name": "satoshis",
},
],
"ltcTicker": undefined,
"tickerLoading": false,
}
@ -25,6 +53,20 @@ Object {
"btcTicker": null,
"crypto": "foo",
"currency": "",
"currencyFilters": Array [
Object {
"key": "btc",
"name": "BTC",
},
Object {
"key": "bits",
"name": "bits",
},
Object {
"key": "sats",
"name": "satoshis",
},
],
"ltcTicker": null,
"tickerLoading": false,
}
@ -35,6 +77,20 @@ Object {
"btcTicker": null,
"crypto": "",
"currency": "foo",
"currencyFilters": Array [
Object {
"key": "btc",
"name": "BTC",
},
Object {
"key": "bits",
"name": "bits",
},
Object {
"key": "sats",
"name": "satoshis",
},
],
"ltcTicker": null,
"tickerLoading": false,
}
@ -45,6 +101,20 @@ Object {
"btcTicker": null,
"crypto": "",
"currency": "",
"currencyFilters": Array [
Object {
"key": "btc",
"name": "BTC",
},
Object {
"key": "bits",
"name": "bits",
},
Object {
"key": "sats",
"name": "satoshis",
},
],
"ltcTicker": null,
"tickerLoading": false,
}

Loading…
Cancel
Save