Skip to content

Commit

Permalink
test(dtslint): add throttleTime (#4121)
Browse files Browse the repository at this point in the history
  • Loading branch information
timdeschryver authored and benlesh committed Oct 10, 2018
1 parent 94ea00a commit a6f4fce
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions spec-dtslint/operators/throttleTime-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { of, asyncScheduler } from 'rxjs';
import { throttleTime } from 'rxjs/operators';

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

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

it('should support a config', () => {
const o = of(1, 2, 3).pipe(throttleTime(47, asyncScheduler, { leading: true, trailing: true })); // $ExpectType Observable<number>
});

it('should enforce types', () => {
const o = of(1, 2, 3).pipe(throttleTime()); // $ExpectError
const p = of(1, 2, 3).pipe(throttleTime('foo')); // $ExpectError
});

it('should enforce scheduler types', () => {
const o = of(1, 2, 3).pipe(throttleTime(47, null)); // $ExpectError
});

it('should enforce config types', () => {
const o = of(1, 2, 3).pipe(throttleTime(47, asyncScheduler, { x: 1 })); // $ExpectError
const p = of(1, 2, 3).pipe(throttleTime(47, asyncScheduler, { leading: 1, trailing: 1 })); // $ExpectError
const q = of(1, 2, 3).pipe(throttleTime(47, asyncScheduler, null)); // $ExpectError
});

0 comments on commit a6f4fce

Please sign in to comment.