You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
6 years ago
|
import React from 'react'
|
||
|
import assert from 'assert'
|
||
|
import thunk from 'redux-thunk'
|
||
|
import configureMockStore from 'redux-mock-store'
|
||
|
import { mount } from 'enzyme'
|
||
6 years ago
|
import Identicon from '../identicon.component'
|
||
6 years ago
|
|
||
6 years ago
|
describe('Identicon', () => {
|
||
6 years ago
|
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', () => {
|
||
6 years ago
|
const wrapper = mount(
|
||
|
<Identicon store={store}/>
|
||
|
)
|
||
|
|
||
6 years ago
|
assert.equal(wrapper.find('img.balance-icon').prop('src'), './images/eth_logo.svg')
|
||
|
})
|
||
|
|
||
|
it('renders custom image and add className props', () => {
|
||
6 years ago
|
const wrapper = mount(
|
||
|
<Identicon
|
||
|
store={store}
|
||
|
className="test-image"
|
||
|
image="test-image"
|
||
|
/>
|
||
|
)
|
||
|
|
||
|
assert.equal(wrapper.find('img.test-image').prop('className'), 'identicon test-image')
|
||
6 years ago
|
assert.equal(wrapper.find('img.test-image').prop('src'), 'test-image')
|
||
|
})
|
||
|
|
||
|
it('renders div with address prop', () => {
|
||
6 years ago
|
const wrapper = mount(
|
||
|
<Identicon
|
||
|
store={store}
|
||
|
className="test-address"
|
||
|
address="0xTest"
|
||
|
/>
|
||
|
)
|
||
|
|
||
|
assert.equal(wrapper.find('div.test-address').prop('className'), 'identicon test-address')
|
||
6 years ago
|
})
|
||
|
})
|