import applyTranslations from './applyTranslations'; describe('applyTranslations', () => { it('should apply translations', async () => { const tests = [ { html: '
Translate me
', translations: { 'Translate me': 'Traduis moi', }, htmlTranslated: '
\n\nTraduis moi\n\n
', }, { html: '
Missing translation
', translations: {}, htmlTranslated: '
\n\nMissing translation\n\n
', }, { html: '

\nFree your notes\n

', translations: { 'Free your notes': 'Libérez vos notes', }, htmlTranslated: '

\nLibérez vos notes\n

', }, { html: '
Save web pages
as notes
', translations: { 'Save web pages
as notes': 'Sauvegardez vos pages web
en notes', }, htmlTranslated: '
\nSauvegardez vos pages web
en notes\n
', }, ]; for (const test of tests) { const actual = applyTranslations(test.html, 'fr_FR', test.translations); expect(actual).toEqual(test.htmlTranslated); } }); });