1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Feature Flag Swap API mock (#14353)

* Feature Flag Swap API mock

* Reorganize API calls in alphabetical order
This commit is contained in:
seaona 2022-04-06 10:05:45 +02:00 committed by GitHub
parent 582f6168f9
commit b84e70895b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(() => {