2016-09-16 15:18:07 +00:00
|
|
|
import i18n from '../../website/common/script/i18n';
|
2019-10-15 13:32:53 +00:00
|
|
|
import './globals.helper';
|
|
|
|
|
import { translations } from '../../website/server/libs/i18n';
|
2019-10-08 18:45:38 +00:00
|
|
|
|
2019-10-15 13:32:53 +00:00
|
|
|
i18n.translations = translations;
|
2015-09-29 12:55:13 +00:00
|
|
|
|
2017-03-10 13:14:42 +00:00
|
|
|
export const STRING_ERROR_MSG = /^Error processing the string ".*". Please see Help > Report a Bug.$/;
|
2015-10-03 15:26:10 +00:00
|
|
|
export const STRING_DOES_NOT_EXIST_MSG = /^String '.*' not found.$/;
|
2015-09-29 12:55:13 +00:00
|
|
|
|
2024-05-14 09:07:15 +00:00
|
|
|
export function expectValidTranslationString (attribute, contextKey) {
|
|
|
|
|
expect(attribute, contextKey).to.be.a('function');
|
2015-09-29 12:55:13 +00:00
|
|
|
|
2019-10-08 18:45:38 +00:00
|
|
|
const translatedString = attribute();
|
2015-09-29 12:55:13 +00:00
|
|
|
|
2024-05-14 09:07:15 +00:00
|
|
|
expect(translatedString.trim(), contextKey).to.not.be.empty;
|
|
|
|
|
expect(translatedString, contextKey).to.not.contain('function func(lang)');
|
|
|
|
|
expect(translatedString, contextKey).to.not.eql(STRING_ERROR_MSG);
|
|
|
|
|
expect(translatedString, contextKey).to.not.match(STRING_DOES_NOT_EXIST_MSG);
|
2015-11-18 14:54:34 +00:00
|
|
|
}
|