From b063e82f24ee287a8943c24b6ff18691668f3e88 Mon Sep 17 00:00:00 2001 From: sjaanus Date: Fri, 13 Dec 2024 12:27:17 +0200 Subject: [PATCH] Fix --- .../cache/client-feature-toggle-cache.test.ts | 53 ++----------------- .../cache/client-feature-toggle-cache.ts | 5 +- 2 files changed, 5 insertions(+), 53 deletions(-) diff --git a/src/lib/features/client-feature-toggles/cache/client-feature-toggle-cache.test.ts b/src/lib/features/client-feature-toggles/cache/client-feature-toggle-cache.test.ts index 5fd8302ad68c..6573adff0ccd 100644 --- a/src/lib/features/client-feature-toggles/cache/client-feature-toggle-cache.test.ts +++ b/src/lib/features/client-feature-toggles/cache/client-feature-toggle-cache.test.ts @@ -51,12 +51,7 @@ test('revision that adds, removes then adds again does not end up with the remov { revisionId: 2, updated: [], - removed: [ - { - name: 'some-toggle', - project: 'default', - }, - ], + removed: ['some-toggle'], }, { revisionId: 3, @@ -81,12 +76,7 @@ test('revision that removes, adds then removes again does not end up with the re { revisionId: 1, updated: [], - removed: [ - { - name: 'some-toggle', - project: 'default', - }, - ], + removed: ['some-toggle'], }, { revisionId: 2, @@ -96,12 +86,7 @@ test('revision that removes, adds then removes again does not end up with the re { revisionId: 3, updated: [], - removed: [ - { - name: 'some-toggle', - project: 'default', - }, - ], + removed: ['some-toggle'], }, ]; @@ -112,12 +97,7 @@ test('revision that removes, adds then removes again does not end up with the re expect(revisions).toEqual({ revisionId: 3, updated: [], - removed: [ - { - name: 'some-toggle', - project: 'default', - }, - ], + removed: ['some-toggle'], }); }); @@ -154,28 +134,3 @@ test('revision equal to the base case returns only later revisions ', () => { removed: [], }); }); - -test('project filter removes features not in project', () => { - const revisionList = [ - { - revisionId: 1, - updated: [mockAdd({ name: 'feature1', project: 'project1' })], - removed: [], - }, - { - revisionId: 2, - updated: [mockAdd({ name: 'feature2', project: 'project2' })], - removed: [], - }, - ]; - - const revisions = calculateRequiredClientRevision(revisionList, 0, [ - 'project1', - ]); - - expect(revisions).toEqual({ - revisionId: 2, - updated: [mockAdd({ name: 'feature1', project: 'project1' })], - removed: [], - }); -}); diff --git a/src/lib/features/client-feature-toggles/cache/client-feature-toggle-cache.ts b/src/lib/features/client-feature-toggles/cache/client-feature-toggle-cache.ts index 106be8168333..a3db4c5d24ff 100644 --- a/src/lib/features/client-feature-toggles/cache/client-feature-toggle-cache.ts +++ b/src/lib/features/client-feature-toggles/cache/client-feature-toggle-cache.ts @@ -73,11 +73,8 @@ export const calculateRequiredClientRevision = ( (revision) => revision.revisionId > requiredRevisionId, ); console.log('targeted revisions', targetedRevisions); - const projectFeatureRevisions = targetedRevisions.map((revision) => - filterRevisionByProject(revision, projects), - ); - return projectFeatureRevisions.reduce(applyRevision); + return targetedRevisions.reduce(applyRevision); }; export class ClientFeatureToggleCache {