Skip to content

Commit

Permalink
test(dtslint): add dtslint test for endWith operator (#4093) (#4175)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkosasih authored and cartant committed Sep 25, 2018
1 parent 028adbd commit 7eeb671
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions spec-dtslint/operators/endWith-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { of, asyncScheduler } from 'rxjs';
import { endWith } from 'rxjs/operators';

it('should support a scheduler', () => {
const a = of(1, 2, 3).pipe(endWith(asyncScheduler)); // $ExpectType Observable<number>
});

it('should infer type for 1 parameter', () => {
const a = of(1, 2, 3).pipe(endWith(4)); // $ExpectType Observable<number>
});

it('should infer type for 2 parameter', () => {
const a = of(1, 2, 3).pipe(endWith(4, 5)); // $ExpectType Observable<number>
});

it('should infer type for 3 parameter', () => {
const a = of(1, 2, 3).pipe(endWith(4, 5, 6)); // $ExpectType Observable<number>
});

it('should infer type for 4 parameter', () => {
const a = of(1, 2, 3).pipe(endWith(4, 5, 6, 7)); // $ExpectType Observable<number>
});

it('should infer type for 5 parameter', () => {
const a = of(1, 2, 3).pipe(endWith(4, 5, 6, 7, 8)); // $ExpectType Observable<number>
});

it('should infer type for 6 parameter', () => {
const a = of(1, 2, 3).pipe(endWith(4, 5, 6, 7, 8, 9)); // $ExpectType Observable<number>
});

it('should infer type for rest parameters', () => {
const a = of(1, 2, 3).pipe(endWith(4, 5, 6, 7, 8, 9, 10)); // $ExpectType Observable<number>
});

it('should accept empty parameter', () => {
const a = of(1, 2, 3).pipe(endWith()); // $ExpectType Observable<number>
});

it('should enforce type', () => {
const a = of(1, 2, 3).pipe(endWith('4')); // $ExpectError
});

0 comments on commit 7eeb671

Please sign in to comment.