fix: minor changes

This commit is contained in:
abdou6666 2024-11-22 14:27:24 +01:00
parent 628d0f5819
commit 7d3a92e1d6
3 changed files with 4 additions and 12 deletions

View File

@ -73,7 +73,7 @@ describe('TranslationService', () => {
find: jest.fn().mockResolvedValue([ find: jest.fn().mockResolvedValue([
{ {
translatable: false, translatable: false,
global_fallback: 'global_fallback', label: 'global_fallback',
fallback_message: ['Global fallback message'], fallback_message: ['Global fallback message'],
}, },
]), ]),
@ -175,7 +175,6 @@ describe('TranslationService', () => {
fallback_message: ['Global fallback message'], fallback_message: ['Global fallback message'],
}, },
} as Settings); } as Settings);
const strings = await service.getSettingStrings(); const strings = await service.getSettingStrings();
expect(strings).toEqual([]); expect(strings).toEqual([]);
}); });

View File

@ -140,8 +140,9 @@ export class TranslationService extends BaseService<Translation> {
return Object.values(settings) return Object.values(settings)
.map((group: Record<string, string | string[]>) => Object.entries(group)) .map((group: Record<string, string | string[]>) => Object.entries(group))
.flat() .flat()
.filter(([l]) => { .filter(([l, value]) => {
return translatableSettings.find(({ label }) => label === l); const found = translatableSettings.find(({ label }) => label === l);
return found && !!value;
}) })
.map(([, v]) => v) .map(([, v]) => v)
.flat(); .flat();

View File

@ -20,14 +20,6 @@ export const settingFixtures: SettingCreateDto[] = [
type: SettingType.text, type: SettingType.text,
weight: 1, weight: 1,
}, },
{
group: 'contact',
label: 'greeting',
value: 'hello',
type: SettingType.text,
weight: 10,
translatable: true,
},
{ {
group: 'contact', group: 'contact',
label: 'company_name', label: 'company_name',