Skip to content

Commit

Permalink
test(throttle): add typings tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed Jan 13, 2018
1 parent 1a363ad commit fac9460
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions spec/operators/throttle-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect } from 'chai';
import * as Rx from '../../src/Rx';
import marbleTestingSignature = require('../helpers/marble-testing'); // tslint:disable-line:no-require-imports

declare const type;
declare const { asDiagram };
declare const hot: typeof marbleTestingSignature.hot;
declare const cold: typeof marbleTestingSignature.cold;
Expand Down Expand Up @@ -338,6 +339,22 @@ describe('Observable.prototype.throttle', () => {
);
});

type('should support selectors of the same type', () => {
/* tslint:disable:no-unused-variable */
let o: Rx.Observable<number>;
let s: Rx.Observable<number>;
let r: Rx.Observable<number> = o.throttle((n) => s);
/* tslint:enable:no-unused-variable */
});

type('should support selectors of a different type', () => {
/* tslint:disable:no-unused-variable */
let o: Rx.Observable<number>;
let s: Rx.Observable<string>;
let r: Rx.Observable<number> = o.throttle((n) => s);
/* tslint:enable:no-unused-variable */
});

describe('throttle(fn, { leading: true, trailing: true })', () => {
asDiagram('throttle(fn, { leading: true, trailing: true })')('should immediately emit the first value in each time window', () => {
const e1 = hot('-a-xy-----b--x--cxxx--|');
Expand Down

0 comments on commit fac9460

Please sign in to comment.