fix side effect in unit tests for languages by only parsing a copy of imported languages object to ember-i18n

This commit is contained in:
jelhan 2015-11-04 12:49:28 +01:00
parent 82c22824a6
commit 8b74eb7d86
2 changed files with 9 additions and 14 deletions

View file

@ -30,7 +30,7 @@ export default {
Ember.FEATURES.I18N_TRANSLATE_HELPER_SPAN = false;
Ember.ENV.I18N_COMPILE_WITHOUT_HANDLEBARS = true;
Ember.I18n.translations = translations[language];
Ember.I18n.translations = Ember.copy(translations[language]);
Ember.I18n.locale = language;
// inject into controller

View file

@ -6,11 +6,7 @@ module('Unit | languages');
// Replace this with your real tests.
test('translations are correct', function(assert) {
assert.ok(languages);
/*
* test not working
* ember-i18n pluralization seems to add another key to languages object
* not sure why this modified languages object is retrieved by test
* https://github.com/jamesarosen/ember-i18n/tree/810aa7f04b2d30903fa094a5aac10bd4c936fcfe#pluralization
Object.keys(languages).map(function(language) {
if (language !== 'en') {
assert.equal(
@ -20,7 +16,6 @@ test('translations are correct', function(assert) {
);
}
});
*/
Object.keys(languages.en).map(function(translationKey) {
Object.keys(languages).map(function(language) {