aboutsummaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/lib/confirm-sig-requests.js15
-rw-r--r--test/integration/lib/currency-localization.js13
-rw-r--r--test/integration/lib/send-new-ui.js5
-rw-r--r--test/integration/lib/tx-list-items.js13
4 files changed, 35 insertions, 11 deletions
diff --git a/test/integration/lib/confirm-sig-requests.js b/test/integration/lib/confirm-sig-requests.js
index c3b0dfcff..699527609 100644
--- a/test/integration/lib/confirm-sig-requests.js
+++ b/test/integration/lib/confirm-sig-requests.js
@@ -15,16 +15,25 @@ QUnit.test('successful confirmation of sig requests', (assert) => {
})
})
-async function runConfirmSigRequestsTest (assert, done) {
+global.ethQuery = global.ethQuery || {}
+
+async function runConfirmSigRequestsTest (assert) {
const selectState = await queryAsync($, 'select')
selectState.val('confirm sig requests')
reactTriggerChange(selectState[0])
+ 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)
}
const pendingRequestItem = $.find('.transaction-list-item .transaction-list-item__grid')
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)
diff --git a/test/integration/lib/send-new-ui.js b/test/integration/lib/send-new-ui.js
index 6a58611d1..78014feef 100644
--- a/test/integration/lib/send-new-ui.js
+++ b/test/integration/lib/send-new-ui.js
@@ -22,9 +22,10 @@ global.ethQuery = {
global.ethereumProvider = {}
-async function runSendFlowTest (assert, done) {
+async function runSendFlowTest (assert) {
const tempFetch = global.fetch
+ const realFetch = window.fetch.bind(window)
global.fetch = (...args) => {
if (args[0] === 'https://ethgasstation.info/json/ethgasAPI.json') {
return Promise.resolve({ json: () => Promise.resolve(JSON.parse(fetchMockResponses.ethGasBasic)) })
@@ -35,7 +36,7 @@ async function runSendFlowTest (assert, done) {
} else if (args[0].match(/chromeextensionmm/)) {
return Promise.resolve({ json: () => Promise.resolve(JSON.parse(fetchMockResponses.metametrics)) })
}
- return window.fetch(...args)
+ return realFetch.fetch(...args)
}
console.log('*** start runSendFlowTest')
diff --git a/test/integration/lib/tx-list-items.js b/test/integration/lib/tx-list-items.js
index c0056dd22..e4478614e 100644
--- a/test/integration/lib/tx-list-items.js
+++ b/test/integration/lib/tx-list-items.js
@@ -20,17 +20,24 @@ global.ethQuery.getTransactionCount = (_, cb) => {
cb(null, '0x4')
}
-async function runTxListItemsTest (assert, done) {
+async function runTxListItemsTest (assert) {
console.log('*** start runTxListItemsTest')
const selectState = await queryAsync($, 'select')
selectState.val('tx list items')
reactTriggerChange(selectState[0])
+ 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)
}
const metamaskLogo = await queryAsync($, '.app-header__logo-container')