1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 09:23:21 +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: [
{
ethereum: {
mobile_active: true,
extension_active: true,
fallback_to_v1: false,
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
bsc: {
mobile_active: true,
extension_active: true,
fallback_to_v1: false,
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
polygon: {
mobile_active: true,
extension_active: true,
fallback_to_v1: false,
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
avalanche: {
mobile_active: true,
extension_active: true,
fallback_to_v1: false,
fallbackToV1: false,
mobileActive: true,
extensionActive: true,
},
smart_transactions: {
mobile_active: false,
extension_active: false,
},
smartTransactions: {
mobileActive: false,
extensionActive: false,

View File

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

View File

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

View File

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

View File

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