Files
remark42/frontend/app/store/comments/utils.test.ts
T
Pavel MineevandUmputun 5825a55b69 Update frontend
* 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
2021-01-12 13:39:26 -06:00

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);
});
});
});