diff --git a/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.test.ts b/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.test.ts index 7ec1cfb76a..511ea6f222 100644 --- a/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.test.ts +++ b/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.test.ts @@ -59,7 +59,7 @@ function createController( state: Partial; clientConfigApiService: AbstractClientConfigApiService; disabled: boolean; - getMetaMetricsId: () => Promise | string; + getMetaMetricsId: () => string; }> = {}, ) { return new RemoteFeatureFlagController({ @@ -69,7 +69,7 @@ function createController( options.clientConfigApiService ?? buildClientConfigApiService(), disabled: options.disabled, getMetaMetricsId: - options.getMetaMetricsId ?? (() => Promise.resolve(MOCK_METRICS_ID)), + options.getMetaMetricsId ?? (() => MOCK_METRICS_ID), }); } @@ -273,7 +273,7 @@ describe('RemoteFeatureFlagController', () => { }); const controller = createController({ clientConfigApiService, - getMetaMetricsId: () => Promise.resolve(MOCK_METRICS_ID), + getMetaMetricsId: () => MOCK_METRICS_ID, }); await controller.updateRemoteFeatureFlags(); @@ -291,7 +291,7 @@ describe('RemoteFeatureFlagController', () => { }); const controller = createController({ clientConfigApiService, - getMetaMetricsId: () => Promise.resolve(MOCK_METRICS_ID), + getMetaMetricsId: () => MOCK_METRICS_ID, }); await controller.updateRemoteFeatureFlags(); @@ -299,25 +299,6 @@ describe('RemoteFeatureFlagController', () => { controller.state.remoteFeatureFlags; expect(nonThresholdFlags).toStrictEqual(MOCK_FLAGS); }); - - it('handles synchronous metaMetricsId', async () => { - const clientConfigApiService = buildClientConfigApiService({ - remoteFeatureFlags: MOCK_FLAGS_WITH_THRESHOLD, - }); - const controller = createController({ - clientConfigApiService, - getMetaMetricsId: () => MOCK_METRICS_ID, - }); - - await controller.updateRemoteFeatureFlags(); - - expect( - controller.state.remoteFeatureFlags.testFlagForThreshold, - ).toStrictEqual({ - name: 'groupC', - value: 'valueC', - }); - }); }); describe('enable and disable', () => { diff --git a/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.ts b/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.ts index 54076f0fb4..afb35032fe 100644 --- a/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.ts +++ b/packages/remote-feature-flag-controller/src/remote-feature-flag-controller.ts @@ -102,7 +102,7 @@ export class RemoteFeatureFlagController extends BaseController< #inProgressFlagUpdate?: Promise; - #getMetaMetricsId: () => string | Promise; + #getMetaMetricsId: () => string; /** * Constructs a new RemoteFeatureFlagController instance. @@ -126,7 +126,7 @@ export class RemoteFeatureFlagController extends BaseController< messenger: RemoteFeatureFlagControllerMessenger; state?: Partial; clientConfigApiService: AbstractClientConfigApiService; - getMetaMetricsId: () => string | Promise; + getMetaMetricsId: () => string; fetchInterval?: number; disabled?: boolean; }) { @@ -208,11 +208,7 @@ export class RemoteFeatureFlagController extends BaseController< remoteFeatureFlags: FeatureFlags, ): Promise { const processedRemoteFeatureFlags: FeatureFlags = {}; - const metaMetricsIdResult = this.#getMetaMetricsId(); - const metaMetricsId = - metaMetricsIdResult instanceof Promise - ? await metaMetricsIdResult - : metaMetricsIdResult; + const metaMetricsId = this.#getMetaMetricsId(); const clientType = this.#clientConfigApiService.getClient(); const thresholdValue = generateDeterministicRandomNumber(