Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(test): fix operator test types a-d #3715

Merged
merged 8 commits into from May 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions spec/operators/bufferTime-spec.ts
Expand Up @@ -18,7 +18,7 @@ describe('bufferTime operator', () => {
w: ['a', 'b'],
x: ['c', 'd', 'e'],
y: ['f', 'g'],
z: []
z: [] as string[]
};

const result = e1.pipe(bufferTime(t, null, Number.POSITIVE_INFINITY, rxTestScheduler));
Expand All @@ -34,7 +34,7 @@ describe('bufferTime operator', () => {
const values = {
x: ['a', 'b', 'c'],
y: ['d', 'e', 'g'],
z: []
z: [] as string[]
};

const result = e1.pipe(bufferTime(t, null, Number.POSITIVE_INFINITY, rxTestScheduler));
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('bufferTime operator', () => {
w: ['a', 'b'],
x: ['c', 'd', 'e'],
y: ['f', 'g'],
z: []
z: [] as string[]
};

const result = e1.pipe(bufferTime(t, null, 3, rxTestScheduler));
Expand Down Expand Up @@ -137,8 +137,8 @@ describe('bufferTime operator', () => {
b: ['4', '5', '6'],
c: ['6', '7', '8'],
d: ['8', '9'],
e: [],
f: []
e: [] as string[],
f: [] as string[]
};

const result = e1.pipe(bufferTime(t, interval, Number.POSITIVE_INFINITY, rxTestScheduler));
Expand All @@ -164,7 +164,7 @@ describe('bufferTime operator', () => {
b: ['4', '5', '6'],
c: ['6', '7', '8'],
d: ['8', '9'],
e: []
e: [] as string[]
};

const result = e1.pipe(bufferTime(t, interval, Number.POSITIVE_INFINITY, rxTestScheduler));
Expand Down Expand Up @@ -222,7 +222,7 @@ describe('bufferTime operator', () => {
const e1 = cold( '|');
const e1subs = '(^!)';
const expected = '(b|)';
const values = { b: [] };
const values = { b: [] as string[] };
const t = time('----------|');

const result = e1.pipe(bufferTime(t, null, Number.POSITIVE_INFINITY, rxTestScheduler));
Expand Down
6 changes: 3 additions & 3 deletions spec/operators/bufferToggle-spec.ts
Expand Up @@ -274,7 +274,7 @@ describe('bufferToggle operator', () => {
const e2 = cold('--o-----|');
const e3 = cold( '-----c--|');
const expected = '|';
const values = { x: [] };
const values = { x: [] as string[] };

const result = e1.pipe(bufferToggle(e2, () => e3));

Expand All @@ -286,7 +286,7 @@ describe('bufferToggle operator', () => {
const e2 = cold('--o-----|');
const e3 = cold( '-----c--|');
const expected = '#';
const values = { x: [] };
const values = { x: [] as string[] };

const result = e1.pipe(bufferToggle(e2, () => e3));

Expand All @@ -300,7 +300,7 @@ describe('bufferToggle operator', () => {
const unsub = ' !';
const subs = '^ !';
const expected = '----x-----x------x-----x---x-----------------';
const values = { x: [] };
const values = { x: [] as string[] };

const result = e1.pipe(bufferToggle(e2, () => e3));

Expand Down
10 changes: 5 additions & 5 deletions spec/operators/bufferWhen-spec.ts
Expand Up @@ -15,7 +15,7 @@ describe('bufferWhen operator', () => {
const values = {
x: ['b', 'c', 'd'],
y: ['e', 'f', 'g'],
z: []
z: [] as string[]
};

expectObservable(e1.pipe(bufferWhen(() => e2))).toBe(expected, values);
Expand Down Expand Up @@ -239,7 +239,7 @@ describe('bufferWhen operator', () => {
const e1subs = '(^!)';
const expected = '(x|)';
const values = {
x: []
x: [] as string[]
};

const result = e1.pipe(bufferWhen(() => e2));
Expand All @@ -254,7 +254,7 @@ describe('bufferWhen operator', () => {
const e1subs = '(^!)';
const expected = '#';
const values = {
x: []
x: [] as string[]
};

const result = e1.pipe(bufferWhen(() => e2));
Expand All @@ -276,7 +276,7 @@ describe('bufferWhen operator', () => {
' ^ !'];
const expected = '--------x-------x-------x-------x-------x----';
const values = {
x: []
x: [] as string[]
};

const source = e1.pipe(bufferWhen(() => e2));
Expand Down Expand Up @@ -346,7 +346,7 @@ describe('bufferWhen operator', () => {
const values = {
x: ['b', 'c', 'd'],
y: ['e', 'f', 'g', 'h'],
z: []
z: [] as string[]
};

const source = e1.pipe(bufferWhen(() => e2));
Expand Down
12 changes: 6 additions & 6 deletions spec/operators/debounce-spec.ts
Expand Up @@ -4,14 +4,14 @@ import { debounce, mergeMap, mapTo } from 'rxjs/operators';
import { TestScheduler } from 'rxjs/testing';
import { hot, cold, expectObservable, expectSubscriptions } from '../helpers/marble-testing';

declare const type;
declare const type: Function;
declare function asDiagram(arg: string): Function;

declare const rxTestScheduler: TestScheduler;

/** @test {debounce} */
describe('debounce operator', () => {
function getTimerSelector(x) {
function getTimerSelector(x: number) {
return () => timer(x, rxTestScheduler);
}

Expand Down Expand Up @@ -287,7 +287,7 @@ describe('debounce operator', () => {
[' ^! ',
' ^ ! '];

function selectorFunction(x) {
function selectorFunction(x: string) {
if (x !== 'c') {
return selector.shift();
} else {
Expand All @@ -307,7 +307,7 @@ describe('debounce operator', () => {
const e1subs = '^ !';
const expected = '--------a-x-yz---bxy---z--c--x--y--z|';

function selectorFunction(x) { return EMPTY; }
function selectorFunction(x: string) { return EMPTY; }

expectObservable(e1.pipe(debounce(selectorFunction))).toBe(expected);
expectSubscriptions(e1.subscriptions).toBe(e1subs);
Expand Down Expand Up @@ -420,8 +420,8 @@ describe('debounce operator', () => {
});

it('should debounce correctly when synchronously reentered', () => {
const results = [];
const source = new Subject();
const results: number[] = [];
const source = new Subject<number>();

source.pipe(debounce(() => of(null))).subscribe(value => {
results.push(value);
Expand Down
4 changes: 2 additions & 2 deletions spec/operators/debounceTime-spec.ts
Expand Up @@ -155,8 +155,8 @@ describe('debounceTime operator', () => {
});

it('should debounce correctly when synchronously reentered', () => {
const results = [];
const source = new Subject();
const results: number[] = [];
const source = new Subject<number>();
const scheduler = new VirtualTimeScheduler();

source.pipe(debounceTime(0, scheduler)).subscribe(value => {
Expand Down
4 changes: 2 additions & 2 deletions spec/operators/do-spec.ts
Expand Up @@ -46,7 +46,7 @@ describe('Observable.prototype.do', () => {

it('should handle everything with an observer', (done: MochaDone) => {
const expected = [1, 2, 3];
const results = [];
const results: number[] = [];

Observable.of(1, 2, 3)
.do(<Rx.Observer<number>>{
Expand Down Expand Up @@ -101,7 +101,7 @@ describe('Observable.prototype.do', () => {

it('should handle an error with observer', () => {
let errored = false;
Observable.throw('bad').do(<any>{ error: function (err) {
Observable.throw('bad').do(<any>{ error: function (err: string) {
expect(err).to.equal('bad');
} })
.subscribe(null, function (err) {
Expand Down
4 changes: 4 additions & 0 deletions spec/tsconfig.check.json
Expand Up @@ -8,6 +8,10 @@
"./ajax/**/*.ts",
"./helpers/**/*.ts",
"./migration/**/*.ts",
"./operators/a*.ts",
"./operators/b*.ts",
"./operators/c*.ts",
"./operators/d*.ts",
"./symbol/**/*.ts",
"./testing/**/*.ts",
"./util/**/*.ts",
Expand Down