diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 0064124bf73d..784d153932d7 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -76,7 +76,7 @@ exports[`should create default config 1`] = ` "flagResolver": FlagResolver { "experiments": { "adminTokenKillSwitch": false, - "allowOrphanedWildcardTokens": false, + "allowOrphanedWildcardTokens": true, "anonymiseEventLog": false, "anonymizeProjectOwners": false, "automatedActions": false, diff --git a/src/test/e2e/stores/api-token-store.e2e.test.ts b/src/test/e2e/stores/api-token-store.e2e.test.ts index 244d755eb504..c7edd1ef7524 100644 --- a/src/test/e2e/stores/api-token-store.e2e.test.ts +++ b/src/test/e2e/stores/api-token-store.e2e.test.ts @@ -41,7 +41,40 @@ test('get token returns the token when exists', async () => { }); describe('count deprecated tokens', () => { - test('should return 0 for all deprecated tokens', async () => { + test('should return 0 if there is no legacy or orphaned tokens', async () => { + await stores.projectStore.create({ + id: 'test', + name: 'test', + }); + await stores.apiTokenStore.insert({ + secret: '*:*.be44368985f7fb3237c584ef86f3d6bdada42ddbd63a019d26955178', + environment: 'default', + type: ApiTokenType.ADMIN, + projects: [], + tokenName: 'admin-token', + }); + await stores.apiTokenStore.insert({ + secret: 'default:development.be44368985f7fb3237c584ef86f3d6bdada42ddbd63a019d26955178', + environment: 'default', + type: ApiTokenType.CLIENT, + projects: ['default'], + tokenName: 'client-token', + }); + await stores.apiTokenStore.insert({ + secret: '*:development.be44368985f7fb3237c584ef86f3d6bdada42ddbd63a019d26955178', + environment: 'default', + type: ApiTokenType.CLIENT, + projects: [], + tokenName: 'client-wildcard-token', + }); + await stores.apiTokenStore.insert({ + secret: '[]:production.3d6bdada42ddbd63a019d26955178be44368985f7fb3237c584ef86f', + environment: 'default', + type: ApiTokenType.FRONTEND, + projects: ['default', 'test'], + tokenName: 'frontend-token', + }); + const deprecatedTokens = await stores.apiTokenStore.countDeprecatedTokens();