diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-02-09 06:16:58 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-02-09 08:43:31 +0800 |
commit | eb919f4710b37d09c9a3a68ed4c719e487cce9d9 (patch) | |
tree | 30e0c843a692ac10c637467b525f9bef0c795f48 /test/unit/ui/add-token.spec.js | |
parent | 2fd9e58e612e9fe341c9107a677238a566e3c1b8 (diff) | |
parent | f39222c9afd9dcab4c6234940eb9a9cb06dbc6f0 (diff) | |
download | tangerine-wallet-browser-eb919f4710b37d09c9a3a68ed4c719e487cce9d9.tar tangerine-wallet-browser-eb919f4710b37d09c9a3a68ed4c719e487cce9d9.tar.gz tangerine-wallet-browser-eb919f4710b37d09c9a3a68ed4c719e487cce9d9.tar.bz2 tangerine-wallet-browser-eb919f4710b37d09c9a3a68ed4c719e487cce9d9.tar.lz tangerine-wallet-browser-eb919f4710b37d09c9a3a68ed4c719e487cce9d9.tar.xz tangerine-wallet-browser-eb919f4710b37d09c9a3a68ed4c719e487cce9d9.tar.zst tangerine-wallet-browser-eb919f4710b37d09c9a3a68ed4c719e487cce9d9.zip |
Merge branch 'uat-next' of https://github.com/MetaMask/metamask-extension into cb-254
Diffstat (limited to 'test/unit/ui/add-token.spec.js')
-rw-r--r-- | test/unit/ui/add-token.spec.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/unit/ui/add-token.spec.js b/test/unit/ui/add-token.spec.js new file mode 100644 index 000000000..69b7fb620 --- /dev/null +++ b/test/unit/ui/add-token.spec.js @@ -0,0 +1,43 @@ +const assert = require('assert') +const { createMockStore } = require('redux-test-utils') +const h = require('react-hyperscript') +const { shallowWithStore } = require('../../lib/shallow-with-store') +const AddTokenScreen = require('../../../old-ui/app/add-token') + +describe('Add Token Screen', function () { + let addTokenComponent, store, component + const mockState = { + metamask: { + identities: { + '0x7d3517b0d011698406d6e0aed8453f0be2697926': { + 'address': '0x7d3517b0d011698406d6e0aed8453f0be2697926', + 'name': 'Add Token Name', + }, + }, + }, + } + beforeEach(function () { + store = createMockStore(mockState) + component = shallowWithStore(h(AddTokenScreen), store) + addTokenComponent = component.dive() + }) + + describe('#ValidateInputs', function () { + + it('Default State', function () { + addTokenComponent.instance().validateInputs() + const state = addTokenComponent.state() + assert.equal(state.warning, 'Address is invalid.') + }) + + it('Address is a Metamask Identity', function () { + addTokenComponent.setState({ + address: '0x7d3517b0d011698406d6e0aed8453f0be2697926', + }) + addTokenComponent.instance().validateInputs() + const state = addTokenComponent.state() + assert.equal(state.warning, 'Personal address detected. Input the token contract address.') + }) + + }) +}) |