{"action":"created","issue":{"url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/291","labels_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/291/labels{/name}","comments_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/291/comments","events_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/291/events","html_url":"https://github.com/jamesarosen/ember-i18n/issues/291","id":101020094,"number":291,"title":"Acceptance testing w/ ember-cli 1.13.8","user":{"login":"toranb","id":147411,"avatar_url":"https://avatars.githubusercontent.com/u/147411?v=3","gravatar_id":"","url":"https://api.github.com/users/toranb","html_url":"https://github.com/toranb","followers_url":"https://api.github.com/users/toranb/followers","following_url":"https://api.github.com/users/toranb/following{/other_user}","gists_url":"https://api.github.com/users/toranb/gists{/gist_id}","starred_url":"https://api.github.com/users/toranb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toranb/subscriptions","organizations_url":"https://api.github.com/users/toranb/orgs","repos_url":"https://api.github.com/users/toranb/repos","events_url":"https://api.github.com/users/toranb/events{/privacy}","received_events_url":"https://api.github.com/users/toranb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-14T14:21:07Z","updated_at":"2015-08-14T16:02:50Z","closed_at":null,"body":"First off - love this project and thanks for all the hours you've put in maintaining it :)\r\n\r\nI just upgraded from ember-cli 1.13.6 to 1.13.8 and found that even though my start-app does an import like so ...\r\n\r\n```js\r\nimport t from \"myapp/tests/helpers/t\";\r\n```\r\n\r\nI started getting errors in application code that would reference it inside the assertion block (not hbs). This includes the following helper code to setup/register the service\r\n\r\n```js\r\nimport Ember from 'ember';\r\n\r\nexport default Ember.Test.registerHelper('t', function(window, key, context) {\r\n    return window.__container__.lookup('service:i18n').t(key, context);\r\n});\r\n```\r\n\r\nI assume this is enough/over kill to get hbs code working in acceptance tests but how should I import \"t\" if I want to use it in my qunit assertions like so?\r\n\r\n```js\r\ntest('we should find the name is translated for whatever reason', function(assert) {\r\n    visit('/');\r\n    andThen(() => {\r\n        var model = store.find('foo', 123);\r\n        assert.equal(model.get('name'), t(\"some.translation.key.here\"));\r\n    });\r\n});\r\n```\r\n\r\n**update**\r\n\r\nI ask because ember-cli now complains saying \r\n\r\n```\r\nt[\"default\"] is not defined\r\n```\r\n\r\n...when I run the test shown above. When I \"debug\" the test I just see t[\"default\"][\"default\"][\"default\"] on and on."},"comment":{"url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/comments/131162961","html_url":"https://github.com/jamesarosen/ember-i18n/issues/291#issuecomment-131162961","issue_url":"https://api.github.com/repos/jamesarosen/ember-i18n/issues/291","id":131162961,"user":{"login":"jamesarosen","id":2406,"avatar_url":"https://avatars.githubusercontent.com/u/2406?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesarosen","html_url":"https://github.com/jamesarosen","followers_url":"https://api.github.com/users/jamesarosen/followers","following_url":"https://api.github.com/users/jamesarosen/following{/other_user}","gists_url":"https://api.github.com/users/jamesarosen/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesarosen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesarosen/subscriptions","organizations_url":"https://api.github.com/users/jamesarosen/orgs","repos_url":"https://api.github.com/users/jamesarosen/repos","events_url":"https://api.github.com/users/jamesarosen/events{/privacy}","received_events_url":"https://api.github.com/users/jamesarosen/received_events","type":"User","site_admin":false},"created_at":"2015-08-14T16:02:50Z","updated_at":"2015-08-14T16:02:50Z","body":"Hmm. If you want to reference translations by key in tests, you're going to have to get access to the `I18nService` somehow. Perhaps this library should offer exactly the test helper you suggest:\r\n```js\r\nEmber.Test.registerHelper('t', function(app, key, context) {\r\n    return app.__container__.lookup('service:i18n').t(key, context);\r\n});\r\n```\r\n\r\n`foo[\"default\"] is not defined` usually means you're importing or exporting something incorrectly. My strong guess is that the result of `Ember.Test.registerHelper` is `undefined`. In that case, I'd try changing your test helper to\r\n```js\r\nimport Ember from 'ember';\r\n\r\nEmber.Test.registerHelper('t', function(app, key, context) {\r\n    return app.__container__.lookup('service:i18n').t(key, context);\r\n});\r\n\r\nexport default function noop() {}\r\n```"}}