Skip to content

Commit

Permalink
Deprecate snake case from feature flags (#15994)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoferro authored Sep 29, 2022
1 parent 455735c commit f3465c9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 31 deletions.
20 changes: 4 additions & 16 deletions test/e2e/mock-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 9 additions & 9 deletions test/jest/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
};
};
Expand Down
6 changes: 3 additions & 3 deletions ui/ducks/swaps/swaps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -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,
});
Expand Down
4 changes: 2 additions & 2 deletions ui/pages/swaps/swaps.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};

Expand Down
2 changes: 1 addition & 1 deletion ui/pages/swaps/swaps.util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f3465c9

Please sign in to comment.