2

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.

SebastianG
  • 8,563
  • 8
  • 47
  • 111
  • Plz provide from what method you are subscribing and example on the rest of your test setup. – Lucho Nov 18 '18 at 20:09
  • @Lucho What method? Redux does not have 'methods' in the store. It has the state. You just get the state values via observables. – SebastianG Nov 18 '18 at 21:01
  • Hi Sebastian, a stackblitz of your component and spec files would be helpful so we can see the full context. – dmcgrandle Nov 19 '18 at 01:02

1 Answers1

-1

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.

SebastianG
  • 8,563
  • 8
  • 47
  • 111