1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Deprecate snake case from feature flags (#15994)

This commit is contained in:
Nicolas Ferro 2022-09-29 18:03:38 +02:00 committed by GitHub
parent 455735c5ce
commit f3465c9485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 31 deletions

View File

@ -121,37 +121,25 @@ async function setupMocking(server, testSpecificMock) {
json: [ json: [
{ {
ethereum: { ethereum: {
mobile_active: true, fallbackToV1: false,
extension_active: true,
fallback_to_v1: false,
mobileActive: true, mobileActive: true,
extensionActive: true, extensionActive: true,
}, },
bsc: { bsc: {
mobile_active: true, fallbackToV1: false,
extension_active: true,
fallback_to_v1: false,
mobileActive: true, mobileActive: true,
extensionActive: true, extensionActive: true,
}, },
polygon: { polygon: {
mobile_active: true, fallbackToV1: false,
extension_active: true,
fallback_to_v1: false,
mobileActive: true, mobileActive: true,
extensionActive: true, extensionActive: true,
}, },
avalanche: { avalanche: {
mobile_active: true, fallbackToV1: false,
extension_active: true,
fallback_to_v1: false,
mobileActive: true, mobileActive: true,
extensionActive: true, extensionActive: true,
}, },
smart_transactions: {
mobile_active: false,
extension_active: false,
},
smartTransactions: { smartTransactions: {
mobileActive: false, mobileActive: false,
extensionActive: false, extensionActive: false,

View File

@ -68,19 +68,19 @@ export const TOKENS_GET_RESPONSE = [
export const createFeatureFlagsResponse = () => { export const createFeatureFlagsResponse = () => {
return { return {
bsc: { bsc: {
mobile_active: false, mobileActive: false,
extension_active: true, extensionActive: true,
fallback_to_v1: true, fallbackToV1: true,
}, },
ethereum: { ethereum: {
mobile_active: false, mobileActive: false,
extension_active: true, extensionActive: true,
fallback_to_v1: true, fallbackToV1: true,
}, },
polygon: { polygon: {
mobile_active: false, mobileActive: false,
extension_active: true, extensionActive: true,
fallback_to_v1: false, fallbackToV1: false,
}, },
}; };
}; };

View File

@ -92,7 +92,7 @@ describe('Ducks - Swaps', () => {
swapsFeatureIsLive: true, swapsFeatureIsLive: true,
}; };
const featureFlagsResponse = MOCKS.createFeatureFlagsResponse(); const featureFlagsResponse = MOCKS.createFeatureFlagsResponse();
featureFlagsResponse.ethereum.extension_active = false; featureFlagsResponse.ethereum.extensionActive = false;
const featureFlagApiNock = mockFeatureFlagsApiResponse({ const featureFlagApiNock = mockFeatureFlagsApiResponse({
featureFlagsResponse, featureFlagsResponse,
}); });
@ -113,8 +113,8 @@ describe('Ducks - Swaps', () => {
swapsFeatureIsLive: false, swapsFeatureIsLive: false,
}; };
const featureFlagsResponse = MOCKS.createFeatureFlagsResponse(); const featureFlagsResponse = MOCKS.createFeatureFlagsResponse();
featureFlagsResponse.ethereum.extension_active = false; featureFlagsResponse.ethereum.extensionActive = false;
featureFlagsResponse.ethereum.fallback_to_v1 = false; featureFlagsResponse.ethereum.fallbackToV1 = false;
const featureFlagApiNock = mockFeatureFlagsApiResponse({ const featureFlagApiNock = mockFeatureFlagsApiResponse({
featureFlagsResponse, featureFlagsResponse,
}); });

View File

@ -638,14 +638,14 @@ export const getSwapsLivenessForNetwork = (swapsFeatureFlags = {}, chainId) => {
}; };
} }
const isNetworkEnabledForNewApi = const isNetworkEnabledForNewApi =
swapsFeatureFlags[networkName].extension_active; swapsFeatureFlags[networkName].extensionActive;
if (isNetworkEnabledForNewApi) { if (isNetworkEnabledForNewApi) {
return { return {
swapsFeatureIsLive: true, swapsFeatureIsLive: true,
}; };
} }
return { return {
swapsFeatureIsLive: swapsFeatureFlags[networkName].fallback_to_v1, swapsFeatureIsLive: swapsFeatureFlags[networkName].fallbackToV1,
}; };
}; };

View File

@ -373,7 +373,7 @@ describe('Swaps Util', () => {
swapsFeatureIsLive: true, swapsFeatureIsLive: true,
}; };
const swapsFeatureFlags = MOCKS.createFeatureFlagsResponse(); const swapsFeatureFlags = MOCKS.createFeatureFlagsResponse();
swapsFeatureFlags[ETHEREUM].extension_active = false; swapsFeatureFlags[ETHEREUM].extensionActive = false;
expect( expect(
getSwapsLivenessForNetwork(swapsFeatureFlags, CHAIN_IDS.MAINNET), getSwapsLivenessForNetwork(swapsFeatureFlags, CHAIN_IDS.MAINNET),
).toMatchObject(expectedSwapsLiveness); ).toMatchObject(expectedSwapsLiveness);