ReactiveX / ReactiveX/rxjs

Problems testing observables that emit arrays or objects with other observables.

Open
#6,243 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
31.7k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

Bug Report

Current Behavior
When using expectObservable to check an observable that emits and object with some observable the test fails.

Expected behavior
The test should pass.

Reproduction
That can be 100% reproduced using the code below.

const highOrderObj = of({ a: of('a') });

it('generate the stream correctly', () => {
  testScheduler.run(({ cold, expectObservable }) => {
    expectObservable(highOrderObj).toBe('(a|)', { a: { a: cold('(a|)') } });
  });
});

Environment

  • Runtime: node v12.22.1
  • RxJS version: 6.6.7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction in index.test.js on the linked Replit project and inspect the expectObservable and TestScheduler behavior shown there. Confirm how emitted objects containing observables are compared, then run the reproduction to verify that the expectation passes for the provided high-order object case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.