Skip to content

Commit

Permalink
fix: add test for settings (#21)
Browse files Browse the repository at this point in the history
* fix: add modulePathIgnorePatterns to jest config

* fix: add test for settings
  • Loading branch information
korvin89 authored Jul 14, 2022
1 parent 91aa59a commit b848503
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type {Config} from '@jest/types';

const cfg: Config.InitialOptions = {
verbose: true,
preset: 'ts-jest',
testEnvironment: 'jsdom',
modulePathIgnorePatterns: ['<rootDir>/build/', '<rootDir>/node_modules/'],
};

export default cfg;
8 changes: 8 additions & 0 deletions src/libs/settings/__tests__/settings.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {DEFAULT_LOCALE_SPECIFICATION, settings} from '../settings';

describe('libs/settings', () => {
it('Default locale should be equal DEFAULT_LOCALE_SPECIFICATION', () => {
const result = settings.get('locale');
expect(result).toBe(DEFAULT_LOCALE_SPECIFICATION);
});
});
2 changes: 1 addition & 1 deletion src/libs/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Settings = {
};
type SettingKey = keyof Settings;

const DEFAULT_LOCALE_SPECIFICATION: moment.LocaleSpecification = {week: {dow: 1, doy: 7}};
export const DEFAULT_LOCALE_SPECIFICATION: moment.LocaleSpecification = {week: {dow: 1, doy: 7}};

const removeUndefinedValues = <T extends Record<string, any>>(data: T) => {
return Object.entries(data).reduce((acc, [key, value]) => {
Expand Down

0 comments on commit b848503

Please sign in to comment.