mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
22 lines
886 B
TypeScript
22 lines
886 B
TypeScript
// FE-COMP-COLMEMORY-001 to -002: how many lists the collections widget showed last time.
|
|
import { readShownCollections, rememberShownCollections } from './collectionsWidgetMemory';
|
|
|
|
afterEach(() => localStorage.clear());
|
|
|
|
describe('collectionsWidgetMemory', () => {
|
|
it('FE-COMP-COLMEMORY-001: remembers the count, kept within the six badges the widget shows', () => {
|
|
expect(readShownCollections()).toBeNull();
|
|
rememberShownCollections(4);
|
|
expect(readShownCollections()).toBe(4);
|
|
rememberShownCollections(9);
|
|
expect(readShownCollections()).toBe(6);
|
|
});
|
|
|
|
it('FE-COMP-COLMEMORY-002: ignores a value that is not a count', () => {
|
|
localStorage.setItem('trek_dash_collections_shown', 'many');
|
|
expect(readShownCollections()).toBeNull();
|
|
localStorage.setItem('trek_dash_collections_shown', '42');
|
|
expect(readShownCollections()).toBeNull();
|
|
});
|
|
});
|