You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently using this library as ember-i18n lacks some of the functionality we already use from i18next. Trying to write integration tests with some of our components but cannot work out how to initialise the i18n service to be utilised as part of the tests.
Is this possible?
If it is possible, are there any helpers that could make this easier or at the very least maybe a little but of documentation for any users of the library.
Cheers
The text was updated successfully, but these errors were encountered:
It turns out to be possible to do this, but it's a little tricky. You can inject the i18n service into the integration test and configure it in the beforeEach() function. Because beforeEach and afterEach apparently don't respect promises (see rwjblue/ember-qunit#192) you have to use assert.async to wait for initialization to finish:
moduleForComponent('some-component','Integration | Component | some component',{integration: true,beforeEach(assert){constdone=assert.async();this.inject.service('i18n');this.get('i18n').initLibraryAsync().then(done);}});
You will probably also want to adjust the i18nextOptions for the test environment to set and preload the initial language as well.
I'll document how this works before releasing the latest version later this week. I haven't looked at trying to create a test helper that initializes i18next yet, but it may be possible.
Currently using this library as ember-i18n lacks some of the functionality we already use from i18next. Trying to write integration tests with some of our components but cannot work out how to initialise the i18n service to be utilised as part of the tests.
Cheers
The text was updated successfully, but these errors were encountered: