Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Dec 13, 2024
1 parent f7e32d4 commit b063e82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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'],
},
];

Expand All @@ -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'],
});
});

Expand Down Expand Up @@ -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: [],
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b063e82

Please sign in to comment.