diff options
Diffstat (limited to 'test/integration/lib/currency-localization.js')
-rw-r--r-- | test/integration/lib/currency-localization.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/integration/lib/currency-localization.js b/test/integration/lib/currency-localization.js index cd10efa30..24c3a1a2d 100644 --- a/test/integration/lib/currency-localization.js +++ b/test/integration/lib/currency-localization.js @@ -16,16 +16,23 @@ QUnit.test('renders localized currency', (assert) => { }) }) -async function runCurrencyLocalizationTest (assert, done) { +async function runCurrencyLocalizationTest (assert) { console.log('*** start runCurrencyLocalizationTest') const selectState = await queryAsync($, 'select') selectState.val('currency localization') + const realFetch = window.fetch.bind(window) global.fetch = (...args) => { - if (args[0].match(/chromeextensionmm/)) { + if (args[0] === 'https://ethgasstation.info/json/ethgasAPI.json') { + return Promise.resolve({ json: () => Promise.resolve(JSON.parse(fetchMockResponses.ethGasBasic)) }) + } else if (args[0] === 'https://ethgasstation.info/json/predictTable.json') { + return Promise.resolve({ json: () => Promise.resolve(JSON.parse(fetchMockResponses.ethGasPredictTable)) }) + } else if (args[0] === 'https://dev.blockscale.net/api/gasexpress.json') { + return Promise.resolve({ json: () => Promise.resolve(JSON.parse(fetchMockResponses.gasExpress)) }) + } else if (args[0].match(/chromeextensionmm/)) { return Promise.resolve({ json: () => Promise.resolve(JSON.parse(fetchMockResponses.metametrics)) }) } - return window.fetch(...args) + return realFetch.fetch(...args) } await timeout(1000) |