Add required props & fix propTypes for SendFooter tests (#7825)

feature/default_network_editable
Whymarrh Whitby 5 years ago committed by GitHub
parent d0536ba984
commit c53a40c45f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      ui/app/pages/send/send-footer/tests/send-footer-component.test.js

@ -44,7 +44,7 @@ describe('SendFooter Component', function () {
to="mockTo" to="mockTo"
toAccounts={['mockAccount']} toAccounts={['mockAccount']}
tokenBalance="mockTokenBalance" tokenBalance="mockTokenBalance"
unapprovedTxs={['mockTx']} unapprovedTxs={{}}
update={propsMethodSpies.update} update={propsMethodSpies.update}
sendErrors={{}} sendErrors={{}}
/> />
@ -87,36 +87,36 @@ describe('SendFooter Component', function () {
}, },
'should return true if gasTotal is falsy': { 'should return true if gasTotal is falsy': {
inError: false, inError: false,
gasTotal: false, gasTotal: '',
expectedResult: true, expectedResult: true,
gasIsLoading: false, gasIsLoading: false,
}, },
'should return true if to is truthy': { 'should return true if to is truthy': {
to: '0xsomevalidAddress', to: '0xsomevalidAddress',
inError: false, inError: false,
gasTotal: false, gasTotal: '',
expectedResult: true, expectedResult: true,
gasIsLoading: false, gasIsLoading: false,
}, },
'should return true if selectedToken is truthy and tokenBalance is falsy': { 'should return true if selectedToken is truthy and tokenBalance is falsy': {
selectedToken: true, selectedToken: { mockProp: 'mockSelectedTokenProp' },
tokenBalance: null, tokenBalance: '',
expectedResult: true, expectedResult: true,
gasIsLoading: false, gasIsLoading: false,
}, },
'should return true if gasIsLoading is truthy but all other params are falsy': { 'should return true if gasIsLoading is truthy but all other params are falsy': {
inError: false, inError: false,
gasTotal: null, gasTotal: '',
selectedToken: null, selectedToken: null,
tokenBalance: 0, tokenBalance: '',
expectedResult: true, expectedResult: true,
gasIsLoading: true, gasIsLoading: true,
}, },
'should return false if inError is false and all other params are truthy': { 'should return false if inError is false and all other params are truthy': {
inError: false, inError: false,
gasTotal: '0x123', gasTotal: '0x123',
selectedToken: true, selectedToken: { mockProp: 'mockSelectedTokenProp' },
tokenBalance: 123, tokenBalance: '123',
expectedResult: false, expectedResult: false,
gasIsLoading: false, gasIsLoading: false,
}, },
@ -154,7 +154,7 @@ describe('SendFooter Component', function () {
gasPrice: 'mockGasPrice', gasPrice: 'mockGasPrice',
selectedToken: { mockProp: 'mockSelectedTokenProp' }, selectedToken: { mockProp: 'mockSelectedTokenProp' },
to: 'mockTo', to: 'mockTo',
unapprovedTxs: ['mockTx'], unapprovedTxs: {},
} }
) )
}) })
@ -197,7 +197,7 @@ describe('SendFooter Component', function () {
describe('render', () => { describe('render', () => {
beforeEach(() => { beforeEach(() => {
sinon.stub(SendFooter.prototype, 'formShouldBeDisabled').returns('formShouldBeDisabledReturn') sinon.stub(SendFooter.prototype, 'formShouldBeDisabled').returns(true)
wrapper = shallow(( wrapper = shallow((
<SendFooter <SendFooter
addToAddressBookIfNew={propsMethodSpies.addToAddressBookIfNew} addToAddressBookIfNew={propsMethodSpies.addToAddressBookIfNew}
@ -217,7 +217,7 @@ describe('SendFooter Component', function () {
to="mockTo" to="mockTo"
toAccounts={['mockAccount']} toAccounts={['mockAccount']}
tokenBalance="mockTokenBalance" tokenBalance="mockTokenBalance"
unapprovedTxs={['mockTx']} unapprovedTxs={{}}
update={propsMethodSpies.update} update={propsMethodSpies.update}
/> />
), { context: { t: str => str, metricsEvent: () => ({}) } }) ), { context: { t: str => str, metricsEvent: () => ({}) } })
@ -237,7 +237,7 @@ describe('SendFooter Component', function () {
onSubmit, onSubmit,
disabled, disabled,
} = wrapper.find(PageContainerFooter).props() } = wrapper.find(PageContainerFooter).props()
assert.equal(disabled, 'formShouldBeDisabledReturn') assert.equal(disabled, true)
assert.equal(SendFooter.prototype.onSubmit.callCount, 0) assert.equal(SendFooter.prototype.onSubmit.callCount, 0)
onSubmit(MOCK_EVENT) onSubmit(MOCK_EVENT)

Loading…
Cancel
Save