Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marble complete not respecting group frames #6931

Closed
iamlothian opened this issue Apr 10, 2022 · 1 comment
Closed

Marble complete not respecting group frames #6931

iamlothian opened this issue Apr 10, 2022 · 1 comment

Comments

@iamlothian
Copy link

iamlothian commented Apr 10, 2022

Describe the bug

When I test an observable with a switchMap containing a merge the Marble string passes but the expected completion frame is wrong. '(abcd)|'

Expected behavior

I expected the completion the be on frame 1 not 6 as frame 0 is a group of 4 emissions. '(abcd)|'

Reproduction code

I have the following observable from a NgRx effect

  ActionFactory$ = createEffect(() =>
    this.actions$.pipe(
      ofType(Actions.loadInitialDataSuccess),
      switchMap(() => merge(
          // a number of observables here the subscribe to web sockets each returning different actions
      )),
      catchError((error) => of(Actions.Failure({ error })))
    )
  );

When I test this

// for context
beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [NxModule.forRoot(), MaterialModule],
      providers: [
        provideMockActions(() => actions),
        provideMockStore(),
      ],
    });
    jest.resetAllMocks();
  });
// the test
  it('should subscribe to messages and emit mapped actions', () => {
    testScheduler.run(({ cold, expectObservable }) => {
      actions = cold('a|', {
        a: Actions.loadInitialDataSuccess({ data }),
      });

      expectObservable(effects.FmeActionFactory$).toBe('(abcd)|', {
        a: Actions.actionA({message: ma}),
        b: Actions.actionA({message: mb}),
        c: Actions.actionA({message: mc}),
        d: Actions.actionA({message: md})
      });
    });
  });

I get the following failure

Object {
    -     "frame": 6,
    +     "frame": 1,
          "notification": Object {
            "error": undefined,
            "kind": "C",
            "value": undefined,
          },

Reproduction URL

No response

Version

7.4.0

Environment

Angualr 13, NgRx: 13

Additional context

No response

@kwonoj
Copy link
Member

kwonoj commented Apr 10, 2022

dupe to #5677. for those reason there are 3rd party test library lile rx-sandbox.

@kwonoj kwonoj closed this as completed Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants