Skip to content

Commit

Permalink
fixup! Persist selected filters in checks results inside Redux
Browse files Browse the repository at this point in the history
  • Loading branch information
dottorblaster committed May 24, 2023
1 parent 5474688 commit df042df
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions assets/js/state/selectors/clusterChecksResultsFilters.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { faker } from '@faker-js/faker';

import { getSelectedFilters } from './clusterChecksResultsFilters';

describe('getSelectedFilters', () => {
it('should return an empty array if the cluster ID is not found', () => {
const clusterID = faker.datatype.uuid();
expect(
getSelectedFilters(clusterID)({ clusterChecksResultsFilters: {} })
).toEqual([]);
});

it('should return a list of selected filters when the cluster ID is found', () => {
const clusterID = faker.datatype.uuid();
const state = {
clusterChecksResultsFilters: { [clusterID]: ['passing', 'critical'] },
};
expect(getSelectedFilters(clusterID)(state)).toEqual([
'passing',
'critical',
]);
});
});

0 comments on commit df042df

Please sign in to comment.