2018-05-05 17:11:53 +02:00
|
|
|
import assert from 'assert'
|
|
|
|
import {
|
2018-06-29 19:19:40 +02:00
|
|
|
gasFeeIsInError,
|
|
|
|
getGasLoadingError,
|
2018-09-20 06:16:43 +02:00
|
|
|
getGasButtonGroupShown,
|
2018-05-05 17:11:53 +02:00
|
|
|
} from '../send-gas-row.selectors.js'
|
|
|
|
|
|
|
|
describe('send-gas-row selectors', () => {
|
|
|
|
|
2018-06-29 19:19:40 +02:00
|
|
|
describe('getGasLoadingError()', () => {
|
2018-05-05 17:11:53 +02:00
|
|
|
it('should return send.errors.gasLoading', () => {
|
|
|
|
const state = {
|
|
|
|
send: {
|
|
|
|
errors: {
|
|
|
|
gasLoading: 'abc',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2018-06-29 19:19:40 +02:00
|
|
|
assert.equal(getGasLoadingError(state), 'abc')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('gasFeeIsInError()', () => {
|
|
|
|
it('should return true if send.errors.gasFee is truthy', () => {
|
|
|
|
const state = {
|
|
|
|
send: {
|
|
|
|
errors: {
|
|
|
|
gasFee: 'def',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(gasFeeIsInError(state), true)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should return false send.errors.gasFee is falsely', () => {
|
|
|
|
const state = {
|
|
|
|
send: {
|
|
|
|
errors: {
|
|
|
|
gasFee: null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(gasFeeIsInError(state), false)
|
2018-05-05 17:11:53 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2018-09-20 06:16:43 +02:00
|
|
|
describe('getGasButtonGroupShown()', () => {
|
|
|
|
it('should return send.gasButtonGroupShown', () => {
|
|
|
|
const state = {
|
|
|
|
send: {
|
|
|
|
gasButtonGroupShown: 'foobar',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(getGasButtonGroupShown(state), 'foobar')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2018-05-05 17:11:53 +02:00
|
|
|
})
|