Created
April 20, 2019 22:32
-
-
Save oops-wrong/db1b3b481b471cd2117b052d7e171eb5 to your computer and use it in GitHub Desktop.
This file contains 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
describe('muteFirst', () => { | |
const first = 'first'; | |
const second = 'second'; | |
const third = 'third'; | |
it('should return the second observable', () => { | |
const first$ = cold('-a', first); | |
const second$ = cold('-b', second); | |
expect(muteFirst(first$, second$)).toBeObservable(second$); | |
}); | |
it('should subscribe the both observables', () => { | |
const first$ = cold('-a', first); | |
const second$ = cold('-b', second); | |
muteFirst(first$, second$).subscribe(); | |
expect(first$.getSubscriptions().length).toBe(1); | |
expect(second$.getSubscriptions().length).toBe(1); | |
}); | |
it('should not return the second value until the second changed', () => { | |
const first$ = cold('-a', first); | |
const second$ = cold('-b-c-d', { b: second, c: second, d: third }); | |
const expected$ = cold('-b---d', { b: second, d: third }); | |
muteFirst(first$, second$).subscribe(); | |
expect(muteFirst(first$, second$)).toBeObservable(expected$); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment