lundi 29 mars 2021

Angular 8 karma test if branch with environment variable

How can I test this branch in constructor of my service?

  constructor() {
    if (environment.logLevel) {
      this.minAcceptedLogLevel = environment.logLevel;
    }
  }

I know that I have to create a service for getting environment variables, but how can I change the value of that property to cover the two branches of the if condition, also being the check inside the constructor?

Aucun commentaire:

Enregistrer un commentaire