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.
44 lines
1.2 KiB
44 lines
1.2 KiB
import React from 'react'
|
|
import assert from 'assert'
|
|
import { shallow } from 'enzyme'
|
|
import withTokenTracker from '../with-token-tracker.component'
|
|
import TokenBalance from '../../../../components/ui/token-balance/token-balance.component'
|
|
// import sinon from 'sinon'
|
|
import TokenTracker from 'eth-token-tracker'
|
|
|
|
const { createTestProviderTools } = require('../../../../../../test/stub/provider')
|
|
|
|
const provider = createTestProviderTools({ scaffold: {} }).provider
|
|
|
|
describe('WithTokenTracker HOC', () => {
|
|
let wrapper
|
|
|
|
beforeEach(() => {
|
|
const TokenTracker = withTokenTracker(TokenBalance)
|
|
wrapper = shallow(
|
|
<TokenTracker
|
|
userAddress="0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
|
|
token={
|
|
{
|
|
address: 'test',
|
|
}
|
|
}
|
|
/>
|
|
)
|
|
})
|
|
|
|
it('#setError', () => {
|
|
wrapper.instance().setError('test')
|
|
assert.equal(wrapper.props().error, 'test')
|
|
})
|
|
|
|
it('#updateBalance', () => {
|
|
wrapper.instance().tracker = new TokenTracker({
|
|
provider,
|
|
})
|
|
wrapper.instance().updateBalance([{ string: 'test string', symbol: 'test symbol' }])
|
|
assert.equal(wrapper.props().string, 'test string')
|
|
assert.equal(wrapper.props().symbol, 'test symbol')
|
|
})
|
|
|
|
})
|
|
|