From fb0b1d64b6dbe0418e7231eba2c864fd7bc98c4f Mon Sep 17 00:00:00 2001 From: Amer Harb Date: Mon, 19 Aug 2024 09:41:39 +0200 Subject: [PATCH] fix unit test to match new data types --- webapp/src/store/ProjectStore.spec.ts | 28 ++++++++++++++++++++------- webapp/src/store/ProjectStore.ts | 2 +- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/webapp/src/store/ProjectStore.spec.ts b/webapp/src/store/ProjectStore.spec.ts index c18c12ee..d070c634 100644 --- a/webapp/src/store/ProjectStore.spec.ts +++ b/webapp/src/store/ProjectStore.spec.ts @@ -35,7 +35,7 @@ describe('ProjectStore', () => { const actual = await projectStore.getTranslations('de'); expect(actual).toEqual({ - 'greeting.headline': 'Hallo', + 'greeting.headline': { sourceFile: '', text: 'Hallo' }, }); }); @@ -66,11 +66,16 @@ describe('ProjectStore', () => { const after = await projectStore.getTranslations('de'); expect(before).toEqual({ - 'greeting.headline': 'Hallo', + 'greeting.headline': { + sourceFile: '', + text: 'Hallo', + }, }); - expect(after).toEqual({ - 'greeting.headline': 'Hallo!', + 'greeting.headline': { + sourceFile: '', + text: 'Hallo!', + }, }); }); @@ -90,7 +95,10 @@ describe('ProjectStore', () => { const actual = await projectStore.getTranslations('de'); expect(actual).toEqual({ - 'greeting.headline': 'Hallo!', + 'greeting.headline': { + sourceFile: '', + text: 'Hallo!', + }, }); }); @@ -147,10 +155,16 @@ describe('ProjectStore', () => { const languages = await projectStore.getLanguageData(); expect(languages).toEqual({ de: { - 'greeting.headline': 'Hallo', + 'greeting.headline': { + sourceFile: '', + text: 'Hallo', + }, }, sv: { - 'greeting.headline': 'Hej', + 'greeting.headline': { + sourceFile: '', + text: 'Hej', + }, }, }); }); diff --git a/webapp/src/store/ProjectStore.ts b/webapp/src/store/ProjectStore.ts index d05ec282..051712ac 100644 --- a/webapp/src/store/ProjectStore.ts +++ b/webapp/src/store/ProjectStore.ts @@ -42,7 +42,7 @@ export class ProjectStore { const output: MessageMap = {}; Object.entries(language).forEach(([key, messageTranslation]) => { - output[key] = messageTranslation; + output[key] = { ...messageTranslation }; }); return output;