You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.2 KiB
60 lines
1.2 KiB
7 years ago
|
import assert from 'assert'
|
||
|
import {
|
||
|
getToDropdownOpen,
|
||
6 years ago
|
getTokens,
|
||
7 years ago
|
sendToIsInError,
|
||
5 years ago
|
} from '../add-recipient.selectors.js'
|
||
7 years ago
|
|
||
5 years ago
|
describe('add-recipient selectors', () => {
|
||
7 years ago
|
|
||
|
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)
|
||
|
})
|
||
|
})
|
||
|
|
||
6 years ago
|
describe('getTokens()', () => {
|
||
|
it('should return empty array if no tokens in state', () => {
|
||
|
const state = {
|
||
|
metamask: {
|
||
|
tokens: [],
|
||
|
},
|
||
|
}
|
||
|
|
||
|
assert.deepStrictEqual(getTokens(state), [])
|
||
|
})
|
||
|
})
|
||
7 years ago
|
})
|