1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-04 15:14:29 +01:00
metamask-extension/ui/app/components/identicon/tests/identicon.component.test.js

52 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-09-24 18:28:04 +02:00
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'
2018-09-24 18:28:04 +02:00
describe('Identicon', () => {
2018-09-24 18:28:04 +02:00
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}/>
)
2018-09-24 18:28:04 +02:00
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')
2018-09-24 18:28:04 +02:00
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')
2018-09-24 18:28:04 +02:00
})
})