From 4e7384429f1003e008d1f25cc3dce6c225933811 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Sun, 19 Aug 2018 11:58:43 +0200 Subject: [PATCH] test(dtslint): add startWith tests --- spec-dtslint/operators/startWith-spec.ts | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 spec-dtslint/operators/startWith-spec.ts diff --git a/spec-dtslint/operators/startWith-spec.ts b/spec-dtslint/operators/startWith-spec.ts new file mode 100644 index 00000000000..8dfde430425 --- /dev/null +++ b/spec-dtslint/operators/startWith-spec.ts @@ -0,0 +1,33 @@ +import { of, asyncScheduler } from 'rxjs'; +import { startWith } from 'rxjs/operators'; +import { TestScheduler } from 'rxjs/testing'; + +declare const rxTestScheduler: TestScheduler; + +it('should infer correctly with one value', () => { + const o = of(1, 2, 3).pipe(startWith(4)); // $ExpectType Observable +}); + +it('should infer correctly with multiple values', () => { + const o = of(1, 2, 3).pipe(startWith(4, 5, 6)); // $ExpectType Observable +}); + +it('should infer correctly with no value', () => { + const o = of(1, 2, 3).pipe(startWith()); // $ExpectType Observable +}); + +it('should infer correctly with a value and a scheduler', () => { + const o = of(1, 2, 3).pipe(startWith(5, asyncScheduler)); // $ExpectType Observable +}); + +it('should infer correctly with only a scheduler', () => { + const o = of(1, 2, 3).pipe(startWith(asyncScheduler)); // $ExpectType Observable +}); + +it('should enforce types with one value', () => { + const o = of(1, 2, 3).pipe(startWith('foo')); // $ExpectError +}); + +it('should enforce types with multiple value', () => { + const o = of(1, 2, 3).pipe(startWith(4, 'foo')); // $ExpectError +});