From b84e70895b64700df2f361c700ed4e2525ce06a5 Mon Sep 17 00:00:00 2001 From: seaona <54408225+seaona@users.noreply.github.com> Date: Wed, 6 Apr 2022 10:05:45 +0200 Subject: [PATCH] Feature Flag Swap API mock (#14353) * Feature Flag Swap API mock * Reorganize API calls in alphabetical order --- test/e2e/mock-e2e.js | 61 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/test/e2e/mock-e2e.js b/test/e2e/mock-e2e.js index 1487567fb..478a5b959 100644 --- a/test/e2e/mock-e2e.js +++ b/test/e2e/mock-e2e.js @@ -1,6 +1,12 @@ async function setupMocking(server, testSpecificMock) { await server.forAnyRequest().thenPassThrough(); + await server.forPost('https://api.segment.io/v1/batch').thenCallback(() => { + return { + statusCode: 200, + }; + }); + await server .forGet('https://gas-api.metaswap.codefi.network/networks/1/gasPrices') .thenCallback(() => { @@ -14,12 +20,6 @@ async function setupMocking(server, testSpecificMock) { }; }); - await server.forPost('https://api.segment.io/v1/batch').thenCallback(() => { - return { - statusCode: 200, - }; - }); - await server .forGet( 'https://gas-api.metaswap.codefi.network/networks/1/suggestedGasFees', @@ -57,6 +57,55 @@ async function setupMocking(server, testSpecificMock) { }; }); + await server + .forGet('https://swap.metaswap.codefi.network/featureFlags') + .thenCallback(() => { + return { + statusCode: 200, + json: [ + { + ethereum: { + mobile_active: true, + extension_active: true, + fallback_to_v1: false, + mobileActive: true, + extensionActive: true, + }, + bsc: { + mobile_active: true, + extension_active: true, + fallback_to_v1: false, + mobileActive: true, + extensionActive: true, + }, + polygon: { + mobile_active: true, + extension_active: true, + fallback_to_v1: false, + mobileActive: true, + extensionActive: true, + }, + avalanche: { + mobile_active: true, + extension_active: true, + fallback_to_v1: false, + mobileActive: true, + extensionActive: true, + }, + smart_transactions: { + mobile_active: false, + extension_active: false, + }, + smartTransactions: { + mobileActive: false, + extensionActive: false, + }, + updated_at: '2022-03-17T15:54:00.360Z', + }, + ], + }; + }); + await server .forGet('https://token-api.metaswap.codefi.network/tokens/1337') .thenCallback(() => {