mardi 19 mai 2020

RxJs operators are not recognized while running angular tests

So, I have a component where I subscribe to change in value in one of the form control on ngOnInit life cycle. But while writing tests the tests for it, I get an error relating to skip not being a function.

My Component file looks like this

  ngOnInit() {
    this.buildForm();
    this.cronTextSubscription = this.cronForm.get('emailCron').valueChanges
      .skip(3)
      .debounceTime(3000)
      .distinctUntilChanged()
      .subscribe(cronPattern => {
        this.updateEmailCronPattern(cronPattern);
      });
    this.fetchCronExpression();
  }

While running the test, I get the following error.

 TypeError: this.cronForm.get(...).valueChanges.skip is not a function

I am new to testing in angular, so any help would be highly appreciated.

Aucun commentaire:

Enregistrer un commentaire