You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.6 KiB
70 lines
1.6 KiB
import React from 'react'
|
|
import { configure, shallow } from 'enzyme'
|
|
import Adapter from 'enzyme-adapter-react-16'
|
|
|
|
import Pay from 'components/Form/Pay'
|
|
|
|
configure({ adapter: new Adapter() })
|
|
|
|
const defaultProps = {
|
|
payform: {
|
|
amount: 0,
|
|
payInput: '',
|
|
invoice: {},
|
|
showErrors: {}
|
|
},
|
|
currency: {},
|
|
crypto: {},
|
|
nodes: [],
|
|
ticker: {},
|
|
|
|
isOnchain: false,
|
|
isLn: true,
|
|
currentAmount: 0,
|
|
usdAmount: 0,
|
|
inputCaption: '',
|
|
showPayLoadingScreen: true,
|
|
payFormIsValid: {},
|
|
currentCurrencyFilters: [],
|
|
currencyName: '',
|
|
|
|
setPayAmount: () => {},
|
|
setPayInput: () => {},
|
|
setCurrencyFilters: () => {},
|
|
fetchInvoice: () => {},
|
|
setCurrency: () => {},
|
|
|
|
onPayAmountBlur: () => {},
|
|
|
|
onPayInputBlur: () => {},
|
|
|
|
onPaySubmit: () => {}
|
|
}
|
|
|
|
describe('Form', () => {
|
|
describe('should show the form without an input', () => {
|
|
const el = shallow(<Pay {...defaultProps} />)
|
|
|
|
it('should contain Pay', () => {
|
|
expect(el.find('input#paymentRequest').props.value).toBe(undefined)
|
|
})
|
|
})
|
|
|
|
describe('should show lightning with a lightning input', () => {
|
|
const props = { ...defaultProps, isLn: true }
|
|
const el = shallow(<Pay {...props} />)
|
|
|
|
it('should contain Pay', () => {
|
|
expect(el.find('input#paymentRequest').props.value).toBe(undefined)
|
|
})
|
|
})
|
|
|
|
describe('should show on-chain with an on-chain input', () => {
|
|
const props = { ...defaultProps, isOnchain: true }
|
|
const el = shallow(<Pay {...props} />)
|
|
|
|
it('should contain Pay', () => {
|
|
expect(el.find('input#paymentRequest').props.value).toBe(undefined)
|
|
})
|
|
})
|
|
})
|
|
|