Skip to content

Commit

Permalink
fix unit test to match new data types
Browse files Browse the repository at this point in the history
  • Loading branch information
amerharb committed Aug 19, 2024
1 parent f9077fc commit fb0b1d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
28 changes: 21 additions & 7 deletions webapp/src/store/ProjectStore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('ProjectStore', () => {

const actual = await projectStore.getTranslations('de');
expect(actual).toEqual({
'greeting.headline': 'Hallo',
'greeting.headline': { sourceFile: '', text: 'Hallo' },
});
});

Expand Down Expand Up @@ -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!',
},
});
});

Expand All @@ -90,7 +95,10 @@ describe('ProjectStore', () => {
const actual = await projectStore.getTranslations('de');

expect(actual).toEqual({
'greeting.headline': 'Hallo!',
'greeting.headline': {
sourceFile: '',
text: 'Hallo!',
},
});
});

Expand Down Expand Up @@ -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',
},
},
});
});
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/store/ProjectStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class ProjectStore {

const output: MessageMap = {};
Object.entries(language).forEach(([key, messageTranslation]) => {
output[key] = messageTranslation;
output[key] = { ...messageTranslation };
});

return output;
Expand Down

0 comments on commit fb0b1d6

Please sign in to comment.