diff --git a/app/components/Form/Pay.js b/app/components/Form/Pay.js index 2b2a2cb1..58c0546b 100644 --- a/app/components/Form/Pay.js +++ b/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 {
- + {isOnchain && @@ -110,7 +110,7 @@ class Pay extends Component { value={payInput} onChange={event => setPayInput(event.target.value)} onBlur={onPayInputBlur} - id='destination' + id='paymentRequest' rows='2' />
@@ -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, diff --git a/test/components/Form.spec.js b/test/components/Form.spec.js index 0df61117..7a383abe 100644 --- a/test/components/Form.spec.js +++ b/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: () => {} } diff --git a/test/components/Form/Pay.spec.js b/test/components/Form/Pay.spec.js index 3d323ec9..a65a225d 100644 --- a/test/components/Form/Pay.spec.js +++ b/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) }) }) }) diff --git a/test/components/Form/Request.spec.js b/test/components/Form/Request.spec.js index 0768dfd8..9092912e 100644 --- a/test/components/Form/Request.spec.js +++ b/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: () => {} } diff --git a/test/reducers/__snapshots__/ticker.spec.js.snap b/test/reducers/__snapshots__/ticker.spec.js.snap index 06102a8b..28c328ee 100644 --- a/test/reducers/__snapshots__/ticker.spec.js.snap +++ b/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, }