Skip to content

Commit

Permalink
test(dtslint): add startWith tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timdeschryver committed Aug 19, 2018
1 parent 229f06a commit 4e73844
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions spec-dtslint/operators/startWith-spec.ts
Original file line number Diff line number Diff line change
@@ -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<number>
});

it('should infer correctly with multiple values', () => {
const o = of(1, 2, 3).pipe(startWith(4, 5, 6)); // $ExpectType Observable<number>
});

it('should infer correctly with no value', () => {
const o = of(1, 2, 3).pipe(startWith()); // $ExpectType Observable<number>
});

it('should infer correctly with a value and a scheduler', () => {
const o = of(1, 2, 3).pipe(startWith(5, asyncScheduler)); // $ExpectType Observable<number>
});

it('should infer correctly with only a scheduler', () => {
const o = of(1, 2, 3).pipe(startWith(asyncScheduler)); // $ExpectType Observable<number>
});

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
});

0 comments on commit 4e73844

Please sign in to comment.