|
|
@ -82,12 +82,12 @@ const MOCK_FETCH_METADATA = { |
|
|
|
chainId: MAINNET_CHAIN_ID, |
|
|
|
chainId: MAINNET_CHAIN_ID, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const MOCK_TOKEN_RATES_STORE = { |
|
|
|
const MOCK_TOKEN_RATES_STORE = () => ({ |
|
|
|
contractExchangeRates: { |
|
|
|
contractExchangeRates: { |
|
|
|
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': 2, |
|
|
|
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': 2, |
|
|
|
'0x1111111111111111111111111111111111111111': 0.1, |
|
|
|
'0x1111111111111111111111111111111111111111': 0.1, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const MOCK_GET_PROVIDER_CONFIG = () => ({ type: 'FAKE_NETWORK' }); |
|
|
|
const MOCK_GET_PROVIDER_CONFIG = () => ({ type: 'FAKE_NETWORK' }); |
|
|
|
|
|
|
|
|
|
|
@ -161,7 +161,7 @@ describe('SwapsController', function () { |
|
|
|
networkController: getMockNetworkController(), |
|
|
|
networkController: getMockNetworkController(), |
|
|
|
provider, |
|
|
|
provider, |
|
|
|
getProviderConfig: MOCK_GET_PROVIDER_CONFIG, |
|
|
|
getProviderConfig: MOCK_GET_PROVIDER_CONFIG, |
|
|
|
tokenRatesStore: MOCK_TOKEN_RATES_STORE, |
|
|
|
getTokenRatesState: MOCK_TOKEN_RATES_STORE, |
|
|
|
fetchTradesInfo: fetchTradesInfoStub, |
|
|
|
fetchTradesInfo: fetchTradesInfoStub, |
|
|
|
getCurrentChainId: getCurrentChainIdStub, |
|
|
|
getCurrentChainId: getCurrentChainIdStub, |
|
|
|
getEIP1559GasFeeEstimates: getEIP1559GasFeeEstimatesStub, |
|
|
|
getEIP1559GasFeeEstimates: getEIP1559GasFeeEstimatesStub, |
|
|
@ -211,7 +211,7 @@ describe('SwapsController', function () { |
|
|
|
networkController, |
|
|
|
networkController, |
|
|
|
provider, |
|
|
|
provider, |
|
|
|
getProviderConfig: MOCK_GET_PROVIDER_CONFIG, |
|
|
|
getProviderConfig: MOCK_GET_PROVIDER_CONFIG, |
|
|
|
tokenRatesStore: MOCK_TOKEN_RATES_STORE, |
|
|
|
getTokenRatesState: MOCK_TOKEN_RATES_STORE, |
|
|
|
fetchTradesInfo: fetchTradesInfoStub, |
|
|
|
fetchTradesInfo: fetchTradesInfoStub, |
|
|
|
getCurrentChainId: getCurrentChainIdStub, |
|
|
|
getCurrentChainId: getCurrentChainIdStub, |
|
|
|
}); |
|
|
|
}); |
|
|
@ -235,7 +235,7 @@ describe('SwapsController', function () { |
|
|
|
networkController, |
|
|
|
networkController, |
|
|
|
provider, |
|
|
|
provider, |
|
|
|
getProviderConfig: MOCK_GET_PROVIDER_CONFIG, |
|
|
|
getProviderConfig: MOCK_GET_PROVIDER_CONFIG, |
|
|
|
tokenRatesStore: MOCK_TOKEN_RATES_STORE, |
|
|
|
getTokenRatesState: MOCK_TOKEN_RATES_STORE, |
|
|
|
fetchTradesInfo: fetchTradesInfoStub, |
|
|
|
fetchTradesInfo: fetchTradesInfoStub, |
|
|
|
getCurrentChainId: getCurrentChainIdStub, |
|
|
|
getCurrentChainId: getCurrentChainIdStub, |
|
|
|
}); |
|
|
|
}); |
|
|
@ -259,7 +259,7 @@ describe('SwapsController', function () { |
|
|
|
networkController, |
|
|
|
networkController, |
|
|
|
provider, |
|
|
|
provider, |
|
|
|
getProviderConfig: MOCK_GET_PROVIDER_CONFIG, |
|
|
|
getProviderConfig: MOCK_GET_PROVIDER_CONFIG, |
|
|
|
tokenRatesStore: MOCK_TOKEN_RATES_STORE, |
|
|
|
getTokenRatesState: MOCK_TOKEN_RATES_STORE, |
|
|
|
fetchTradesInfo: fetchTradesInfoStub, |
|
|
|
fetchTradesInfo: fetchTradesInfoStub, |
|
|
|
getCurrentChainId: getCurrentChainIdStub, |
|
|
|
getCurrentChainId: getCurrentChainIdStub, |
|
|
|
}); |
|
|
|
}); |
|
|
@ -816,9 +816,10 @@ describe('SwapsController', function () { |
|
|
|
.stub(swapsController, '_getERC20Allowance') |
|
|
|
.stub(swapsController, '_getERC20Allowance') |
|
|
|
.resolves(ethers.BigNumber.from(1)); |
|
|
|
.resolves(ethers.BigNumber.from(1)); |
|
|
|
|
|
|
|
|
|
|
|
swapsController.tokenRatesStore = { |
|
|
|
swapsController.getTokenRatesState = () => ({ |
|
|
|
contractExchangeRates: {}, |
|
|
|
contractExchangeRates: {}, |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const [newQuotes, topAggId] = await swapsController.fetchAndSetQuotes( |
|
|
|
const [newQuotes, topAggId] = await swapsController.fetchAndSetQuotes( |
|
|
|
MOCK_FETCH_PARAMS, |
|
|
|
MOCK_FETCH_PARAMS, |
|
|
|
MOCK_FETCH_METADATA, |
|
|
|
MOCK_FETCH_METADATA, |
|
|
|