aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/identicon/tests/identicon.component.test.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-11-02 09:29:45 +0800
committerGitHub <noreply@github.com>2018-11-02 09:29:45 +0800
commit337a4e1b4ea7a560d773bc262b2adffd1617a39b (patch)
treef3c2f9b33642ef9be901645645734129686e6c6e /ui/app/components/identicon/tests/identicon.component.test.js
parentc2f97717c0fbf9a64cf527891f7a1f35049fb023 (diff)
parentde231c7a6191ca869308b6d27ca9cd4b020e59aa (diff)
downloadtangerine-wallet-browser-337a4e1b4ea7a560d773bc262b2adffd1617a39b.tar.gz
tangerine-wallet-browser-337a4e1b4ea7a560d773bc262b2adffd1617a39b.tar.zst
tangerine-wallet-browser-337a4e1b4ea7a560d773bc262b2adffd1617a39b.zip
Merge pull request #5649 from MetaMask/develop
Version 4.17.0
Diffstat (limited to 'ui/app/components/identicon/tests/identicon.component.test.js')
-rw-r--r--ui/app/components/identicon/tests/identicon.component.test.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/ui/app/components/identicon/tests/identicon.component.test.js b/ui/app/components/identicon/tests/identicon.component.test.js
new file mode 100644
index 000000000..2944818f5
--- /dev/null
+++ b/ui/app/components/identicon/tests/identicon.component.test.js
@@ -0,0 +1,51 @@
+import React from 'react'
+import assert from 'assert'
+import thunk from 'redux-thunk'
+import configureMockStore from 'redux-mock-store'
+import { mount } from 'enzyme'
+import Identicon from '../identicon.component'
+
+describe('Identicon', () => {
+ 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(
+ <Identicon 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(
+ <Identicon
+ store={store}
+ className="test-image"
+ image="test-image"
+ />
+ )
+
+ assert.equal(wrapper.find('img.test-image').prop('className'), 'identicon test-image')
+ assert.equal(wrapper.find('img.test-image').prop('src'), 'test-image')
+ })
+
+ it('renders div with address prop', () => {
+ const wrapper = mount(
+ <Identicon
+ store={store}
+ className="test-address"
+ address="0xTest"
+ />
+ )
+
+ assert.equal(wrapper.find('div.test-address').prop('className'), 'identicon test-address')
+ })
+})