angularjasmineangular-reduxangular-test

@angular-redux/store trying to test component that uses async on a property decorated with @select() - documentation does not exist


I am trying to test a form that has a select form control with options that are iterated with ngFor with | async pipe on property 'videoCategories' decorated with @select() from the redux package.

I can't make that form control valid for a test because I have no options from default and I want to mock some options in there. I'll probably need to do this to many other tests throughout my application.

Now, I'm trying to use the MockNgRedux from @angular-redux/store/testing to do this and have been through the intellisense and github pages of the package with no luck.

My code so far:

   spyOn(MockNgRedux, 'videoCategories').and.callFake(() => {
      return Observable.create({
        id: 1,
        name: 'Test Category',
        description: 'Test Category Description'
      });
    });

But of course, it does not work.


Solution

  • Switched to @ngrx/store and learned how to properly deal with observables. angular-redux module is outdated and I have no idea why anyone recommended it to me.