-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Persist selected filters in checks results inside Redux
- Loading branch information
1 parent
5474688
commit df042df
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
assets/js/state/selectors/clusterChecksResultsFilters.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
]); | ||
}); | ||
}); |