diff options
author | Thomas Huang <tmashuang@users.noreply.github.com> | 2018-09-26 12:17:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-26 12:17:17 +0800 |
commit | db30bbce4c0d977e4efe901fddc46fbe5a6aaac4 (patch) | |
tree | 8f84b8116a7b6760dd46c7ce3ff1cd6ba001e3df /test/unit/ui/app/components/identicon.spec.js | |
parent | 88b5f82e1360ab7dd9873a5d7105fbbe1130d839 (diff) | |
parent | a0a57c24fd639c4808ed3e083089b9f1fb3373e6 (diff) | |
download | tangerine-wallet-browser-db30bbce4c0d977e4efe901fddc46fbe5a6aaac4.tar.gz tangerine-wallet-browser-db30bbce4c0d977e4efe901fddc46fbe5a6aaac4.tar.zst tangerine-wallet-browser-db30bbce4c0d977e4efe901fddc46fbe5a6aaac4.zip |
Merge pull request #5332 from MetaMask/ui-unit-tests
Some Ui tests
Diffstat (limited to 'test/unit/ui/app/components/identicon.spec.js')
-rw-r--r-- | test/unit/ui/app/components/identicon.spec.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/unit/ui/app/components/identicon.spec.js b/test/unit/ui/app/components/identicon.spec.js new file mode 100644 index 000000000..a2f8d8246 --- /dev/null +++ b/test/unit/ui/app/components/identicon.spec.js @@ -0,0 +1,36 @@ +import React from 'react' +import assert from 'assert' +import thunk from 'redux-thunk' +import configureMockStore from 'redux-mock-store' +import { mount } from 'enzyme' + +import IdenticonComponent from '../../../../../ui/app/components/identicon' + +describe('Identicon Component', () => { + + const state = { + metamask: { + useBlockie: false, + }, + } + + const middlewares = [thunk] + const mockStore = configureMockStore(middlewares) + const store = mockStore(state) + + it('renders default eth_logo identicon with no props', () => { + const wrapper = mount(<IdenticonComponent store={store}/>) + assert.equal(wrapper.find('img.balance-icon').prop('src'), './images/eth_logo.svg') + }) + + it('renders custom image and add className props', () => { + const wrapper = mount(<IdenticonComponent store={store} className={'test-image'} image={'test-image'} />) + assert.equal(wrapper.find('img.test-image').prop('className'), 'test-image identicon') + assert.equal(wrapper.find('img.test-image').prop('src'), 'test-image') + }) + + it('renders div with address prop', () => { + const wrapper = mount(<IdenticonComponent store={store} className={'test-address'} address={'0xTest'} />) + assert.equal(wrapper.find('div.test-address').prop('className'), 'test-address identicon') + }) +}) |