Problems testing observables that emit arrays or objects with other observables.
Open
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.
- REPL or Repo link:
https://replit.com/@fcostarodrigo/testSchedulerHighOrderObservables#index.test.js
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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