From ea328e5b4386b1827acd56f9b1efadcafb163249 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:14:34 +0200 Subject: [PATCH] fix: prevent config resolver snapshot test (#8041) Prevent test failing on a system with different environment variables. Spreading `experimental` serves similar purpose. --- .../__snapshots__/create-config.test.ts.snap | 86 ------------------- src/lib/create-config.test.ts | 7 +- 2 files changed, 6 insertions(+), 87 deletions(-) diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index cff03e2432..f6d302a676 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -70,92 +70,6 @@ exports[`should create default config 1`] = ` Symbol(kCapture): false, }, "feedbackUriPath": undefined, - "flagResolver": FlagResolver { - "experiments": { - "addonUsageMetrics": false, - "adminTokenKillSwitch": false, - "anonymiseEventLog": false, - "anonymizeProjectOwners": false, - "archiveProjects": false, - "automatedActions": false, - "caseInsensitiveInOperators": false, - "celebrateUnleash": false, - "collectTrafficDataUsage": false, - "demo": false, - "disableBulkToggle": false, - "disableMetrics": false, - "disableNotifications": false, - "disablePublishUnannouncedEvents": false, - "disableShowContextFieldSelectionValues": false, - "disableUpdateMaxRevisionId": false, - "displayTrafficDataUsage": false, - "edgeBulkMetrics": false, - "embedProxy": true, - "embedProxyFrontend": true, - "enableLegacyVariants": false, - "enableLicense": false, - "enableLicenseChecker": false, - "encryptEmails": false, - "estimateTrafficDataCost": false, - "extendedMetrics": false, - "extendedUsageMetrics": false, - "featureSearchFeedback": { - "enabled": false, - "name": "withText", - "payload": { - "type": "json", - "value": "", - }, - }, - "featureSearchFeedbackPosting": false, - "featuresExportImport": true, - "feedbackComments": { - "enabled": false, - "name": "feedbackComments", - "payload": { - "type": "json", - "value": "", - }, - }, - "filterInvalidClientMetrics": false, - "googleAuthEnabled": false, - "killScheduledChangeRequestCache": false, - "maintenanceMode": false, - "manyStrategiesPagination": false, - "messageBanner": { - "enabled": false, - "name": "message-banner", - "payload": { - "type": "json", - "value": "", - }, - }, - "migrationLock": true, - "navigationSidebar": true, - "newEventSearch": false, - "onboardingMetrics": false, - "onboardingUI": false, - "originMiddleware": false, - "outdatedSdksBanner": false, - "personalAccessTokensKillSwitch": false, - "projectListImprovements": false, - "projectOverviewRefactorFeedback": false, - "queryMissingTokens": false, - "removeUnsafeInlineStyleSrc": false, - "responseTimeMetricsFix": false, - "responseTimeWithAppNameKillSwitch": false, - "showInactiveUsers": false, - "signals": false, - "strictSchemaValidation": false, - "useMemoizedActiveTokens": false, - "useProjectReadModel": false, - "userAccessUIEnabled": false, - }, - "externalResolver": { - "getVariant": [Function], - "isEnabled": [Function], - }, - }, "frontendApi": { "refreshIntervalInMs": 2700000, }, diff --git a/src/lib/create-config.test.ts b/src/lib/create-config.test.ts index 286809e818..e69eb7b500 100644 --- a/src/lib/create-config.test.ts +++ b/src/lib/create-config.test.ts @@ -15,8 +15,13 @@ test('should create default config', async () => { }, }); - const { experimental, ...configWithoutExperimental } = config; + const { experimental, flagResolver, ...configWithoutExperimental } = config; expect(configWithoutExperimental).toMatchSnapshot(); + expect(flagResolver).toMatchObject({ + getAll: expect.any(Function), + isEnabled: expect.any(Function), + getVariant: expect.any(Function), + }); }); test('should add initApiToken for admin token from options', async () => {