1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-27 21:00:13 +01:00
metamask-extension/ui/app/selectors/tests/tokens.test.js
Thomas Huang 5d1c9313db
Various component tests and some conditional statements (#7765)
* Various component tests and some conditional statements

Conditional in account-menu in removeAccount when keyring sometimes is not initially provideed
Conditional on unlock-page when there is no target.getBoundingClientRect on the element.

* Update helpers

* Remove component debugging

* Add default params for render helpers

* Remove stubComponent for old Mascot
Changes in https://github.com/MetaMask/metamask-extension/pull/7893 has prevented the need to stub it out.

Change logout to lock in account-menu test
2020-01-30 11:34:45 -08:00

29 lines
703 B
JavaScript

import assert from 'assert'
import { selectedTokenSelector } from '../tokens'
const metaToken = {
'address': '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
'symbol': 'META',
'decimals': 18,
}
const state = {
metamask: {
selectedTokenAddress: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
tokens: [
{
'address': '0x06012c8cf97bead5deae237070f9587f8e7a266d',
'symbol': 'CK',
'decimals': 0,
},
metaToken,
],
},
}
describe('Selected Token Selector', () => {
it('selects token info from tokens based on selectedTokenAddress in state', () => {
const tokenInfo = selectedTokenSelector(state)
assert.equal(tokenInfo, metaToken)
})
})