1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-24 12:23:39 +02:00
metamask-extension/ui/app/pages/send/send-content/add-recipient/tests/add-recipient-selectors.test.js
Whymarrh Whitby 4f3fc95d50
Update ESLint rules for test suite (#8023)
* Use @metamask/eslint-config@1.1.0
* Use eslint-plugin-mocha@6.2.2
* Mark root ESLint config as root
* Update Mocha ESLint rules with shared ESLint config
2020-02-11 13:21:13 -03:30

60 lines
1.2 KiB
JavaScript

import assert from 'assert'
import {
getToDropdownOpen,
getTokens,
sendToIsInError,
} from '../add-recipient.selectors.js'
describe('add-recipient selectors', function () {
describe('getToDropdownOpen()', function () {
it('should return send.getToDropdownOpen', function () {
const state = {
send: {
toDropdownOpen: false,
},
}
assert.equal(getToDropdownOpen(state), false)
})
})
describe('sendToIsInError()', function () {
it('should return true if send.errors.to is truthy', function () {
const state = {
send: {
errors: {
to: 'abc',
},
},
}
assert.equal(sendToIsInError(state), true)
})
it('should return false if send.errors.to is falsy', function () {
const state = {
send: {
errors: {
to: null,
},
},
}
assert.equal(sendToIsInError(state), false)
})
})
describe('getTokens()', function () {
it('should return empty array if no tokens in state', function () {
const state = {
metamask: {
tokens: [],
},
}
assert.deepStrictEqual(getTokens(state), [])
})
})
})