mirror of
https://github.com/hexastack/hexabot
synced 2024-11-24 04:53:41 +00:00
fix: minor changes
This commit is contained in:
parent
628d0f5819
commit
7d3a92e1d6
@ -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([]);
|
||||||
});
|
});
|
||||||
|
@ -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();
|
||||||
|
8
api/src/utils/test/fixtures/setting.ts
vendored
8
api/src/utils/test/fixtures/setting.ts
vendored
@ -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',
|
||||||
|
Loading…
Reference in New Issue
Block a user