2022-05-06 03:16:12 -05:00
|
|
|
import { newSearchSelection, updateSearchSelection } from './selection';
|
|
|
|
|
|
|
|
describe('Search selection helper', () => {
|
|
|
|
it('simple dashboard selection', () => {
|
|
|
|
let sel = newSearchSelection();
|
|
|
|
expect(sel.isSelected('dash', 'aaa')).toBe(false);
|
|
|
|
|
|
|
|
sel = updateSearchSelection(sel, true, 'dash', ['aaa']);
|
|
|
|
expect(sel.isSelected('dash', 'aaa')).toBe(true);
|
2022-05-23 12:01:18 -05:00
|
|
|
expect(sel.isSelected('dash', '*')).toBeTruthy();
|
|
|
|
expect(sel.isSelected('alert', '*')).toBeFalsy();
|
|
|
|
expect(sel.isSelected('*', '*')).toBeTruthy();
|
2022-05-06 03:16:12 -05:00
|
|
|
|
|
|
|
sel = updateSearchSelection(sel, false, 'dash', ['aaa']);
|
|
|
|
expect(sel.isSelected('dash', 'aaa')).toBe(false);
|
|
|
|
expect(sel.items).toMatchInlineSnapshot(`Map {}`);
|
2022-05-23 12:01:18 -05:00
|
|
|
expect(sel.isSelected('*', '*')).toBeFalsy();
|
2022-05-06 03:16:12 -05:00
|
|
|
});
|
|
|
|
});
|