Open ghost opened 1 year ago
I found a way to pass the I18nService
into my services and on their corresponding unit-tests, I do:
const module: TestingModule = await Test.createTestingModule({
imports: [
I18nModule.forRoot({
fallbackLanguage: 'en-US',
loaderOptions: {
path: path.join(__dirname, '../locales'),
watch: true,
},
resolvers: [{ use: QueryResolver, options: ['lang'] }],
}),
],
providers: [ExampleService],
}).compile();
The drawback is that the translation can't be tested because the resolver won't work at this level. It will only return the passed key (although in the "normal" app-launch-mode, it all works), details here #495
how can i get its value for a service test by jest