Last active
February 24, 2020 10:30
-
-
Save OliverJAsh/b7a478d4f4179537711c05e0541c4086 to your computer and use it in GitHub Desktop.
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
import { marbles } from 'rxjs-marbles/jest'; | |
import { delayUntil } from '../operators'; | |
describe('delayUntil', () => { | |
it( | |
'if notifier emits nothing and then completes after source emits, emits when notifier completes', | |
marbles(m => { | |
const source$ = m.cold(' --a--(b|)'); | |
const notifier$ = m.cold('----------|'); | |
const expected = ' ----------(ab|)'; | |
const actual$ = source$.pipe(delayUntil(notifier$)); | |
m.expect(actual$).toBeObservable(expected); | |
}), | |
); | |
it( | |
'if notifier emits after source emits, emits when notifier emits', | |
marbles(m => { | |
const source$ = m.cold(' --a--(b|)'); | |
const notifier$ = m.cold('----------a'); | |
const expected = ' ----------(ab|)'; | |
const actual$ = source$.pipe(delayUntil(notifier$)); | |
m.expect(actual$).toBeObservable(expected); | |
}), | |
); | |
it( | |
'if notifier completes before source emits, emits when source emits', | |
marbles(m => { | |
const source$ = m.cold(' -------a--(b|)'); | |
const notifier$ = m.cold('--|'); | |
const expected = ' -------a--(b|)'; | |
const actual$ = source$.pipe(delayUntil(notifier$)); | |
m.expect(actual$).toBeObservable(expected); | |
}), | |
); | |
it( | |
'if notifier emits before source emits, emits when source emits', | |
marbles(m => { | |
const source$ = m.cold(' -------a--(b|)'); | |
const notifier$ = m.cold('--a'); | |
const expected = ' -------a--(b|)'; | |
const actual$ = source$.pipe(delayUntil(notifier$)); | |
m.expect(actual$).toBeObservable(expected); | |
}), | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment