Skip to content

Commit f08392b

Browse files
committed
test(identity): revert redefining ENV and adapt controller init to match
Signed-off-by: Mircea Nistor <mirceanis@gmail.com>
1 parent cb99ce7 commit f08392b

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

app/scripts/controller-init/identity/authentication-controller-init.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
import { Env, Platform } from '@metamask/profile-sync-controller/sdk';
66
import { ControllerInitFunction } from '../types';
77
import { AuthenticationControllerMessenger } from '../messengers/identity';
8-
import { isProduction } from '../../../../shared/modules/environment';
8+
import { isDevOrTestBuild } from '../../services/oauth/config';
99

1010
/**
1111
* Initialize the Authentication controller.
@@ -22,7 +22,7 @@ export const AuthenticationControllerInit: ControllerInitFunction<
2222
> = ({ controllerMessenger, persistedState, getMetaMetricsId }) => {
2323
const controller = new AuthenticationController({
2424
config: {
25-
env: isProduction() ? Env.PRD : Env.DEV,
25+
env: isDevOrTestBuild() ? Env.DEV : Env.PRD,
2626
},
2727
messenger: controllerMessenger,
2828
state:

app/scripts/controller-init/identity/user-storage-controller-init.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import {
66
import { captureException } from '@sentry/browser';
77
import { Env } from '@metamask/profile-sync-controller/sdk';
88
import { ControllerInitFunction } from '../types';
9-
import { isProduction } from '../../../../shared/modules/environment';
109
import {
1110
MetaMetricsEventCategory,
1211
MetaMetricsEventName,
1312
} from '../../../../shared/constants/metametrics';
1413
import { trace } from '../../../../shared/lib/trace';
14+
import { isDevOrTestBuild } from '../../services/oauth/config';
1515

1616
/**
1717
* Initialize the UserStorage controller.
@@ -32,9 +32,9 @@ export const UserStorageControllerInit: ControllerInitFunction<
3232
// @ts-expect-error Controller uses string for names rather than enum
3333
trace,
3434
config: {
35-
env: isProduction() ? Env.PRD : Env.DEV,
35+
env: isDevOrTestBuild() ? Env.DEV : Env.PRD,
3636
accountSyncing: {
37-
maxNumberOfAccountsToAdd: isProduction() ? undefined : 100,
37+
maxNumberOfAccountsToAdd: isDevOrTestBuild() ? 100 : undefined,
3838
onAccountAdded: (profileId) => {
3939
trackEvent({
4040
category: MetaMetricsEventCategory.BackupAndSync,

development/build/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const ENVIRONMENT = {
2222
PULL_REQUEST: 'pull-request',
2323
RELEASE_CANDIDATE: 'release-candidate',
2424
STAGING: 'staging',
25-
TESTING: 'test',
25+
TESTING: 'testing',
2626
};
2727

2828
const TASKS = {

shared/modules/environment.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('isProduction', () => {
2222
expect(isProduction()).toBe(false);
2323
});
2424

25-
it('should return false when ENVIRONMENT is "test"', () => {
25+
it('should return false when ENVIRONMENT is "testing"', () => {
2626
process.env.METAMASK_ENVIRONMENT = ENVIRONMENT.TESTING;
2727
expect(isProduction()).toBe(false);
2828
});

ui/selectors/selectors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,7 @@ export function getIsSwapsChain(state, overrideChainId) {
18631863
const chainId = overrideChainId ?? currentChainId;
18641864
const isDevelopment =
18651865
process.env.METAMASK_ENVIRONMENT === 'development' ||
1866-
process.env.METAMASK_ENVIRONMENT === 'test';
1866+
process.env.METAMASK_ENVIRONMENT === 'testing';
18671867
return isDevelopment
18681868
? ALLOWED_DEV_SWAPS_CHAIN_IDS.includes(chainId)
18691869
: ALLOWED_PROD_SWAPS_CHAIN_IDS.includes(chainId);

0 commit comments

Comments
 (0)