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
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('add-recipient selectors', function () {
|
2018-05-05 17:11:53 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('getToDropdownOpen()', function () {
|
|
|
|
it('should return send.getToDropdownOpen', function () {
|
2018-05-05 17:11:53 +02:00
|
|
|
const state = {
|
|
|
|
send: {
|
|
|
|
toDropdownOpen: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(getToDropdownOpen(state), false)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('sendToIsInError()', function () {
|
|
|
|
it('should return true if send.errors.to is truthy', function () {
|
2018-05-05 17:11:53 +02:00
|
|
|
const state = {
|
|
|
|
send: {
|
|
|
|
errors: {
|
|
|
|
to: 'abc',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(sendToIsInError(state), true)
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should return false if send.errors.to is falsy', function () {
|
2018-05-05 17:11:53 +02:00
|
|
|
const state = {
|
|
|
|
send: {
|
|
|
|
errors: {
|
|
|
|
to: null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.equal(sendToIsInError(state), false)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('getTokens()', function () {
|
|
|
|
it('should return empty array if no tokens in state', function () {
|
2019-01-22 20:05:59 +01:00
|
|
|
const state = {
|
|
|
|
metamask: {
|
|
|
|
tokens: [],
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.deepStrictEqual(getTokens(state), [])
|
|
|
|
})
|
|
|
|
})
|
2018-05-05 17:11:53 +02:00
|
|
|
})
|