Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

325
Views
Angular Test: to test app.module.ts ngx-translate

I dont seem to find any good article for testing things in app.module.ts I recently using ngx-translate library and I have the code in app.module.ts

I am wondering how to write test against code in app.module.ts The Sonar cloud always complain about test coverage. I don't find a way to test the code in app.module.ts Only way just move all these to share lib

import { Observable, of } from "rxjs";
const enLang = require("../assets/i18n/en-US.json");
const frLang = require("../assets/i18n/fr-FR.json");

const languages = {
  "en-US": enLang,
  "fr-FR": frLang,
}

class JsonLoader implements TranslateLoader {
  getTranslation(lang: string): Observable<any> {
    return of(languages[lang]);
  }
}

@NgModule({
  declarations:
    [AppComponent],
  imports: [
    TranslateModule.forRoot({
      loader: { provide: TranslateLoader, useClass: JsonLoader }
    }),
  ],
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!