Last active
August 14, 2018 20:11
-
-
Save DanielRamosAcosta/aef483916e0443d465b98d424f8e0ee5 to your computer and use it in GitHub Desktop.
RxJS test without marbles diagrams
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('multiplies each number by 2', done => { | |
| const numbers$ = interval(1000).pipe( | |
| take(3), | |
| map(n => n + 1) | |
| ) | |
| // This emits: -1-2-3-| | |
| const numbersTwoTimes$ = numTwoTimes(numbers$) | |
| const results: number[] = [] | |
| numbersTwoTimes$.subscribe( | |
| n => { | |
| results.push(n) | |
| }, | |
| err => { | |
| done(err) | |
| }, | |
| () => { | |
| expect(results).toEqual([2, 4, 6]) | |
| done() | |
| } | |
| ) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment