* change root dit and change way to import modules * update deps to latest versions * use latest tools for building bundles * rewrite webpack config * use nomodule technique for loading modern bundle * inject polyfills by babel usebuiltins * update eslint rules * rename all style files to CSS * use postcss preset env for building styles * proper typescript typing * put all html files to templates folder * etc
23 lines
632 B
TypeScript
23 lines
632 B
TypeScript
import { getInitialSort } from './utils';
|
|
import { DEFAULT_SORT, LS_SORT_KEY } from 'common/constants';
|
|
|
|
describe('store comments utils', () => {
|
|
beforeEach(() => {
|
|
localStorage.clear();
|
|
});
|
|
|
|
describe('getInitialSort', () => {
|
|
it('should return default sorting', () => {
|
|
expect(getInitialSort()).toBe(DEFAULT_SORT);
|
|
});
|
|
|
|
it('should return value from local storage', () => {
|
|
const currentSort = '+active';
|
|
|
|
localStorage.setItem(LS_SORT_KEY, currentSort);
|
|
expect(getInitialSort()).toBe(currentSort);
|
|
expect(localStorage.getItem).toHaveBeenCalledWith(LS_SORT_KEY);
|
|
});
|
|
});
|
|
});
|