feat: ajouter 14 langues africaines (dont le yoruba, hors DeepL)
This commit is contained in:
@@ -57,4 +57,28 @@ describe('translateLyrics', () => {
|
||||
expect(result.anglais).toContain('traduit-EN');
|
||||
expect(result.espagnol).toBeUndefined();
|
||||
});
|
||||
|
||||
it('traduit les langues africaines ajoutées, sans appeler DeepL pour le yoruba', async () => {
|
||||
global.fetch = vi.fn(async (_url, options) => {
|
||||
const {target_lang: target} = JSON.parse(options.body);
|
||||
return fakeDeeplResponse(`traduit-${target}`);
|
||||
});
|
||||
|
||||
const strapi = {
|
||||
contentType: vi.fn(() => ({uid: 'api::parole.parole', kind: 'collectionType'})),
|
||||
log: {error: vi.fn()}
|
||||
};
|
||||
const service = createService({strapi});
|
||||
const result = await service.translateLyrics('Bonjour le monde');
|
||||
|
||||
expect(result.swahili).toContain('traduit-SW');
|
||||
expect(result.lingala).toContain('traduit-LN');
|
||||
expect(result.wolof).toContain('traduit-WO');
|
||||
expect(result.hausa).toContain('traduit-HA');
|
||||
expect(result.yoruba).toBeUndefined();
|
||||
|
||||
const calledTargets = global.fetch.mock.calls.map(([, options]) => JSON.parse(options.body).target_lang);
|
||||
expect(calledTargets).not.toContain('YO');
|
||||
expect(calledTargets).not.toContain(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user