From e954a860bf650c2d6d626b0c327431239ef1e140 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 23 Dec 2021 17:59:18 +0100 Subject: [PATCH] Added test for migrateDeprecatedSettings function --- test/settings/helpers/index.test.ts | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/settings/helpers/index.test.ts diff --git a/test/settings/helpers/index.test.ts b/test/settings/helpers/index.test.ts new file mode 100644 index 00000000..0a3b349e --- /dev/null +++ b/test/settings/helpers/index.test.ts @@ -0,0 +1,31 @@ +import { Mock } from 'ts-mockery'; +import { migrateDeprecatedSettings } from '../../../src/settings/helpers'; +import { ShlinkState } from '../../../src/container/types'; + +describe('settings-helpers', () => { + describe('migrateDeprecatedSettings', () => { + it('updates settings as expected', () => { + const state = Mock.of({ + settings: { + visits: { + defaultInterval: 'last180days' as any, + }, + ui: { + tagsMode: 'list', + } as any, + }, + }); + + expect(migrateDeprecatedSettings(state)).toEqual(expect.objectContaining({ + settings: expect.objectContaining({ + visits: { + defaultInterval: 'last180Days', + }, + tags: { + defaultMode: 'list', + }, + }), + })); + }); + }); +});