From 318e2bf8ca6c8d022264d2e983879e33a23df25b Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Wed, 29 Aug 2018 10:18:36 +1000 Subject: [PATCH] test(dtslint): add shareReplay --- spec-dtslint/operators/shareReplay-spec.ts | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 spec-dtslint/operators/shareReplay-spec.ts diff --git a/spec-dtslint/operators/shareReplay-spec.ts b/spec-dtslint/operators/shareReplay-spec.ts new file mode 100644 index 00000000000..d51dc1d37fa --- /dev/null +++ b/spec-dtslint/operators/shareReplay-spec.ts @@ -0,0 +1,30 @@ +import { of, asyncScheduler } from 'rxjs'; +import { shareReplay } from 'rxjs/operators'; + +it('should accept an individual bufferSize parameter', () => { + const o = of(1, 2, 3).pipe(shareReplay(1)); // $ExpectType Observable +}); + +it('should accept individual bufferSize and windowTime parameters', () => { + const o = of(1, 2, 3).pipe(shareReplay(1, 2)); // $ExpectType Observable +}); + +it('should accept individual bufferSize, windowTime and scheduler parameters', () => { + const o3 = of(1, 2, 3).pipe(shareReplay(1, 2, asyncScheduler)); // $ExpectType Observable +}); + +it('should accept a bufferSize config parameter', () => { + const o = of(1, 2, 3).pipe(shareReplay({ bufferSize: 1, refCount: true })); // $ExpectType Observable +}); + +it('should accept bufferSize and windowTime config parameters', () => { + const o = of(1, 2, 3).pipe(shareReplay({ bufferSize: 1, windowTime: 2, refCount: true })); // $ExpectType Observable +}); + +it('should accept bufferSize, windowTime and scheduler config parameters', () => { + const o = of(1, 2, 3).pipe(shareReplay({ bufferSize: 1, windowTime: 2, scheduler: asyncScheduler, refCount: true })); // $ExpectType Observable +}); + +it('should require a refCount config parameter', () => { + const o = of(1, 2, 3).pipe(shareReplay({ bufferSize: 1 })); // $ExpectError +});