2018-05-05 17:11:53 +02:00
|
|
|
import assert from 'assert'
|
|
|
|
import {
|
|
|
|
getToDropdownOpen,
|
2019-01-22 20:05:59 +01:00
|
|
|
getTokens,
|
2018-05-05 17:11:53 +02:00
|
|
|
sendToIsInError,
|
2019-07-31 21:56:44 +02:00
|
|
|
} from '../add-recipient.selectors.js'
|
2018-05-05 17:11:53 +02:00
|
|
|
|
2019-07-31 21:56:44 +02:00
|
|
|
describe('add-recipient selectors', () => {
|
2018-05-05 17:11:53 +02:00
|
|
|
|
|
|
|
describe('getToDropdownOpen()', () => {
|
|
|
|
it('should return send.getToDropdownOpen', () => {
|
|
|
|
const state = {
|
|
|
|
send: {
|
|
|
|
toDropdownOpen: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(getToDropdownOpen(state), false)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('sendToIsInError()', () => {
|
|
|
|
it('should return true if send.errors.to is truthy', () => {
|
|
|
|
const state = {
|
|
|
|
send: {
|
|
|
|
errors: {
|
|
|
|
to: 'abc',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(sendToIsInError(state), true)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should return false if send.errors.to is falsy', () => {
|
|
|
|
const state = {
|
|
|
|
send: {
|
|
|
|
errors: {
|
|
|
|
to: null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(sendToIsInError(state), false)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2019-01-22 20:05:59 +01:00
|
|
|
describe('getTokens()', () => {
|
|
|
|
it('should return empty array if no tokens in state', () => {
|
|
|
|
const state = {
|
|
|
|
metamask: {
|
|
|
|
tokens: [],
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.deepStrictEqual(getTokens(state), [])
|
|
|
|
})
|
|
|
|
})
|
2018-05-05 17:11:53 +02:00
|
|
|
})
|