mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Clean up for send refactor PR.
This commit is contained in:
parent
dc2b5d0ef4
commit
0de765aa25
@ -2,8 +2,7 @@ const fs = require('fs')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const pump = require('pump')
|
const pump = require('pump')
|
||||||
const browserify = require('browserify')
|
const browserify = require('browserify')
|
||||||
let tests = fs.readdirSync(path.join(__dirname, 'lib'))
|
const tests = fs.readdirSync(path.join(__dirname, 'lib'))
|
||||||
tests = tests.filter(fln => fln.match(/send/))
|
|
||||||
const bundlePath = path.join(__dirname, 'bundle.js')
|
const bundlePath = path.join(__dirname, 'bundle.js')
|
||||||
|
|
||||||
const b = browserify()
|
const b = browserify()
|
||||||
|
@ -35,7 +35,7 @@ export default class FromDropdown extends Component {
|
|||||||
closeDropdown={closeDropdown}
|
closeDropdown={closeDropdown}
|
||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
activeAddress={selectedAccount.address}
|
activeAddress={selectedAccount.address}
|
||||||
/>},
|
/>}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ export default class SendToRow extends Component {
|
|||||||
return (
|
return (
|
||||||
<SendRowWrapper
|
<SendRowWrapper
|
||||||
errorType={'to'}
|
errorType={'to'}
|
||||||
label={`${this.context.t('to')}:`}
|
label={`${this.context.t('to')}`}
|
||||||
showError={inError}
|
showError={inError}
|
||||||
>
|
>
|
||||||
<EnsInput
|
<EnsInput
|
||||||
|
@ -81,7 +81,7 @@ describe('SendToRow Component', function () {
|
|||||||
|
|
||||||
assert.equal(errorType, 'to')
|
assert.equal(errorType, 'to')
|
||||||
|
|
||||||
assert.equal(label, 'to_t:')
|
assert.equal(label, 'to_t')
|
||||||
|
|
||||||
assert.equal(showError, false)
|
assert.equal(showError, false)
|
||||||
})
|
})
|
||||||
|
@ -16,7 +16,6 @@ const utilsStubs = {
|
|||||||
addressIsNew: sinon.stub().returns(true),
|
addressIsNew: sinon.stub().returns(true),
|
||||||
constructTxParams: sinon.stub().returns('mockConstructedTxParams'),
|
constructTxParams: sinon.stub().returns('mockConstructedTxParams'),
|
||||||
constructUpdatedTx: sinon.stub().returns('mockConstructedUpdatedTxParams'),
|
constructUpdatedTx: sinon.stub().returns('mockConstructedUpdatedTxParams'),
|
||||||
formShouldBeDisabled: sinon.stub().returns('mockFormShouldBeDisabled'),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proxyquire('../send-footer.container.js', {
|
proxyquire('../send-footer.container.js', {
|
||||||
@ -53,27 +52,18 @@ describe('send-footer container', () => {
|
|||||||
it('should map the correct properties to props', () => {
|
it('should map the correct properties to props', () => {
|
||||||
assert.deepEqual(mapStateToProps('mockState'), {
|
assert.deepEqual(mapStateToProps('mockState'), {
|
||||||
amount: 'mockAmount:mockState',
|
amount: 'mockAmount:mockState',
|
||||||
disabled: 'mockFormShouldBeDisabled',
|
|
||||||
selectedToken: 'mockSelectedToken:mockState',
|
selectedToken: 'mockSelectedToken:mockState',
|
||||||
editingTransactionId: 'mockEditingTransactionId:mockState',
|
editingTransactionId: 'mockEditingTransactionId:mockState',
|
||||||
from: 'mockFromObject:mockState',
|
from: 'mockFromObject:mockState',
|
||||||
gasLimit: 'mockGasLimit:mockState',
|
gasLimit: 'mockGasLimit:mockState',
|
||||||
gasPrice: 'mockGasPrice:mockState',
|
gasPrice: 'mockGasPrice:mockState',
|
||||||
|
gasTotal: 'mockGasTotal:mockState',
|
||||||
inError: 'mockInError:mockState',
|
inError: 'mockInError:mockState',
|
||||||
isToken: true,
|
|
||||||
to: 'mockTo:mockState',
|
to: 'mockTo:mockState',
|
||||||
toAccounts: 'mockToAccounts:mockState',
|
toAccounts: 'mockToAccounts:mockState',
|
||||||
|
tokenBalance: 'mockTokenBalance:mockState',
|
||||||
unapprovedTxs: 'mockUnapprovedTxs:mockState',
|
unapprovedTxs: 'mockUnapprovedTxs:mockState',
|
||||||
})
|
})
|
||||||
assert.deepEqual(
|
|
||||||
utilsStubs.formShouldBeDisabled.getCall(0).args[0],
|
|
||||||
{
|
|
||||||
inError: 'mockInError:mockState',
|
|
||||||
selectedToken: 'mockSelectedToken:mockState',
|
|
||||||
tokenBalance: 'mockTokenBalance:mockState',
|
|
||||||
gasTotal: 'mockGasTotal:mockState',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -142,6 +142,7 @@ describe('Send Component', function () {
|
|||||||
|
|
||||||
it('should not call updateSendTokenBalance or this.updateGas if network === prevNetwork', () => {
|
it('should not call updateSendTokenBalance or this.updateGas if network === prevNetwork', () => {
|
||||||
SendTransactionScreen.prototype.updateGas.resetHistory()
|
SendTransactionScreen.prototype.updateGas.resetHistory()
|
||||||
|
propsMethodSpies.updateSendTokenBalance.resetHistory()
|
||||||
wrapper.instance().componentDidUpdate({
|
wrapper.instance().componentDidUpdate({
|
||||||
from: {
|
from: {
|
||||||
balance: 'balanceChanged',
|
balance: 'balanceChanged',
|
||||||
@ -168,6 +169,7 @@ describe('Send Component', function () {
|
|||||||
|
|
||||||
it('should call updateSendTokenBalance and this.updateGas with the correct params', () => {
|
it('should call updateSendTokenBalance and this.updateGas with the correct params', () => {
|
||||||
SendTransactionScreen.prototype.updateGas.resetHistory()
|
SendTransactionScreen.prototype.updateGas.resetHistory()
|
||||||
|
propsMethodSpies.updateSendTokenBalance.resetHistory()
|
||||||
wrapper.instance().componentDidUpdate({
|
wrapper.instance().componentDidUpdate({
|
||||||
from: {
|
from: {
|
||||||
balance: 'balanceChanged',
|
balance: 'balanceChanged',
|
||||||
|
Loading…
Reference in New Issue
Block a user