/
githubmirror
/
strapi
Обзор
Документация
Войти
/
githubmirror
/
strapi
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/plugins/i18n/admin/src/utils/tests/prefixPluginTranslations.test.ts
40 строк
1 KB
Simone
chore(helper-plugin)!: remove prefixPluginTranslations (#19845)
19 мар 2024, 19:33
Не верифицирован
19 мар 2024, 19:33
c46976a
Код
Авторство
О чём код?
import { prefixPluginTranslations } from '../prefixPluginTranslations'; describe('prefixPluginTranslations', () => { it('should prefix plugin translations keys with plugin ID', () => { const trad = { key1: 'Value 1', key2: 'Value 2', }; const pluginId = 'myPlugin'; const expectedOutput = { 'myPlugin.key1': 'Value 1', 'myPlugin.key2': 'Value 2', }; const result = prefixPluginTranslations(trad, pluginId); expect(result).toEqual(expectedOutput); }); it('should return an empty object when given an empty object', () => { const trad = {}; const pluginId = 'myPlugin'; const expectedOutput = {}; const result = prefixPluginTranslations(trad, pluginId); expect(result).toEqual(expectedOutput); }); it('should throw TypeError if pluginId is provided as an empty string', () => { const trad = { key1: 'Value 1', }; const pluginId = ''; expect(() => { prefixPluginTranslations(trad, pluginId); }).toThrowError(new TypeError("pluginId can't be empty")); }); });