From 84ec236ad53e5e49063e785e2cb0ba854079ca38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B0=D0=B5=D0=B2=20=D0=95=D0=B2=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= Date: Thu, 14 Jul 2022 17:19:17 +0300 Subject: [PATCH 1/2] fix: add modulePathIgnorePatterns to jest config --- jest.config.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jest.config.ts b/jest.config.ts index b0fe784f..49abaefb 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,8 +1,10 @@ import type {Config} from '@jest/types'; const cfg: Config.InitialOptions = { + verbose: true, preset: 'ts-jest', testEnvironment: 'jsdom', + modulePathIgnorePatterns: ['/build/', '/node_modules/'], }; export default cfg; From 9f75373618dd1093dddafc72480e916ec4189df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B0=D0=B5=D0=B2=20=D0=95=D0=B2=D0=B3=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= Date: Thu, 14 Jul 2022 17:33:17 +0300 Subject: [PATCH 2/2] fix: add test for settings --- src/libs/settings/__tests__/settings.test.ts | 8 ++++++++ src/libs/settings/settings.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/libs/settings/__tests__/settings.test.ts diff --git a/src/libs/settings/__tests__/settings.test.ts b/src/libs/settings/__tests__/settings.test.ts new file mode 100644 index 00000000..895640e6 --- /dev/null +++ b/src/libs/settings/__tests__/settings.test.ts @@ -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); + }); +}); diff --git a/src/libs/settings/settings.ts b/src/libs/settings/settings.ts index 72067bdd..042959e1 100644 --- a/src/libs/settings/settings.ts +++ b/src/libs/settings/settings.ts @@ -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 = >(data: T) => { return Object.entries(data).reduce((acc, [key, value]) => {