{"action":"created","issue":{"url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/339","repository_url":"https://api.github.com/repos/jamesarosen/ember-i18n","labels_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/339/comments","events_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/339/events","html_url":"https://github.com/jamesarosen/ember-i18n/issues/339","id":119037904,"number":339,"title":"Test for missing translations","user":{"login":"jelhan","id":4965703,"avatar_url":"https://avatars.githubusercontent.com/u/4965703?v=3","gravatar_id":"","url":"https://api.github.com/users/jelhan","html_url":"https://github.com/jelhan","followers_url":"https://api.github.com/users/jelhan/followers","following_url":"https://api.github.com/users/jelhan/following{/other_user}","gists_url":"https://api.github.com/users/jelhan/gists{/gist_id}","starred_url":"https://api.github.com/users/jelhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jelhan/subscriptions","organizations_url":"https://api.github.com/users/jelhan/orgs","repos_url":"https://api.github.com/users/jelhan/repos","events_url":"https://api.github.com/users/jelhan/events{/privacy}","received_events_url":"https://api.github.com/users/jelhan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-26T12:44:48Z","updated_at":"2016-04-10T19:10:27Z","closed_at":null,"body":"I like to test my application against missing translations in different locales. What's the best practice to do so? I have written a working test (https://github.com/jelhan/croodle/commit/c5a42ce9d8eb8864ccfaa1787de1bddf4fd81d4f) but it looks like crap. Would like to hear how others solved this issue and perhaps work together to improve documentation."},"comment":{"url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/comments/208046074","html_url":"https://github.com/jamesarosen/ember-i18n/issues/339#issuecomment-208046074","issue_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/339","id":208046074,"user":{"login":"blimmer","id":630449,"avatar_url":"https://avatars.githubusercontent.com/u/630449?v=3","gravatar_id":"","url":"https://api.github.com/users/blimmer","html_url":"https://github.com/blimmer","followers_url":"https://api.github.com/users/blimmer/followers","following_url":"https://api.github.com/users/blimmer/following{/other_user}","gists_url":"https://api.github.com/users/blimmer/gists{/gist_id}","starred_url":"https://api.github.com/users/blimmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blimmer/subscriptions","organizations_url":"https://api.github.com/users/blimmer/orgs","repos_url":"https://api.github.com/users/blimmer/repos","events_url":"https://api.github.com/users/blimmer/events{/privacy}","received_events_url":"https://api.github.com/users/blimmer/received_events","type":"User","site_admin":false},"created_at":"2016-04-10T19:10:27Z","updated_at":"2016-04-10T19:10:27Z","body":"There are definitely times in my app that I expected an error to be thrown in test. In this case, I was testing to make sure that my app could handle an unexpected piece of content in the payload. In this example, we dynamically look up a translation (something like this):\r\n\r\n```js\r\nreturn this.get('i18n').t(`myBaseKey.${this.get('somethingElse')`); // no translation for my test value\r\n```\r\n\r\nIn that case I had to do this in my test:\r\n\r\n```js\r\n    it('is not visible if translation is missing', function() {\r\n      try {\r\n        this.set('setting.settingName', 'idontexist');\r\n        this.render(hbs `{{setting-option option=setting}}`);\r\n        componentDoesNotHaveElement(this, '.setting-option:visible');\r\n      } catch (MissingTranslationError) {} // Eat the error we throw\r\n    });\r\n```\r\n\r\nIt might be too much to ask users to deal with that, but I'm open to ideas."}}