habitica/test/content/translator.js

15 lines
629 B
JavaScript
Raw Permalink Normal View History

2019-10-08 18:45:38 +00:00
import { STRING_ERROR_MSG, STRING_DOES_NOT_EXIST_MSG } from '../helpers/content.helper';
import translator from '../../website/common/script/content/translation';
2015-09-29 12:55:13 +00:00
describe('Translator', () => {
it('returns error message if string is not properly formatted', () => {
2019-10-08 18:45:38 +00:00
const improperlyFormattedString = translator('petName', { attr: 0 })();
expect(improperlyFormattedString).to.match(STRING_ERROR_MSG);
2015-09-29 12:55:13 +00:00
});
it('returns an error message if string does not exist', () => {
2019-10-08 18:45:38 +00:00
const stringDoesNotExist = translator('stringDoesNotExist')();
2015-09-29 12:55:13 +00:00
expect(stringDoesNotExist).to.match(STRING_DOES_NOT_EXIST_MSG);
});
});