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