WA-232 Refactor jest.fn().mockImplementation for fetching ERC20 tokens in tests
This commit is contained in:
parent
c7a2a2ae52
commit
bcece2e72e
|
@ -15,11 +15,8 @@ import { buildMathPropsFrom } from '~/test/utils/buildReactRouterProps'
|
||||||
import { tokenListSelector, activeTokensSelector } from '~/routes/tokens/store/selectors'
|
import { tokenListSelector, activeTokensSelector } from '~/routes/tokens/store/selectors'
|
||||||
import { getTokens } from '~/utils/localStorage/tokens'
|
import { getTokens } from '~/utils/localStorage/tokens'
|
||||||
import { enableFirstToken, testToken } from '~/test/builder/tokens.dom.utils'
|
import { enableFirstToken, testToken } from '~/test/builder/tokens.dom.utils'
|
||||||
|
import * as fetchTokensModule from '~/routes/tokens/store/actions/fetchTokens'
|
||||||
const fetchTokensModule = require('../routes/tokens/store/actions/fetchTokens')
|
import * as enhancedFetchModule from '~/utils/fetch'
|
||||||
|
|
||||||
// $FlowFixMe
|
|
||||||
fetchTokensModule.fetchTokensData = jest.fn()
|
|
||||||
|
|
||||||
describe('DOM > Feature > Enable and disable default tokens', () => {
|
describe('DOM > Feature > Enable and disable default tokens', () => {
|
||||||
let web3
|
let web3
|
||||||
|
@ -33,7 +30,8 @@ describe('DOM > Feature > Enable and disable default tokens', () => {
|
||||||
firstErc20Token = await getFirstTokenContract(web3, accounts[0])
|
firstErc20Token = await getFirstTokenContract(web3, accounts[0])
|
||||||
secondErc20Token = await getSecondTokenContract(web3, accounts[0])
|
secondErc20Token = await getSecondTokenContract(web3, accounts[0])
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
fetchTokensModule.fetchTokensData.mockImplementation(() => Promise.resolve([
|
enhancedFetchModule.enhancedFetch = jest.fn()
|
||||||
|
enhancedFetchModule.enhancedFetch.mockImplementation(() => Promise.resolve([
|
||||||
{
|
{
|
||||||
address: firstErc20Token.address,
|
address: firstErc20Token.address,
|
||||||
name: 'First Token Example',
|
name: 'First Token Example',
|
||||||
|
|
Loading…
Reference in New Issue