diff --git a/packages/rxjs/spec/operators/buffer-spec.ts b/packages/rxjs/spec/operators/buffer-spec.ts index debb7fa9d5..81bfefb16f 100644 --- a/packages/rxjs/spec/operators/buffer-spec.ts +++ b/packages/rxjs/spec/operators/buffer-spec.ts @@ -3,6 +3,7 @@ import { EMPTY, NEVER, throwError, of, Subject, interval } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { observableMatcher } from '../helpers/observableMatcher'; import { expect } from 'chai'; +import * as sinon from 'sinon'; /** @test {buffer} */ describe('Observable.prototype.buffer', () => { @@ -325,6 +326,8 @@ describe('Observable.prototype.buffer', () => { }); it('should buffer when Promise resolves', (done) => { + const sandbox = sinon.createSandbox(); + const fakeTimers = sandbox.useFakeTimers(); const e1 = interval(3).pipe(take(5)); const expected = [ [0, 1], @@ -338,9 +341,12 @@ describe('Observable.prototype.buffer', () => { error: () => done(new Error('should not be called')), complete: () => { expect(expected.length).to.equal(0); + sandbox.restore(); done(); }, }); + + fakeTimers.tickAsync(15); }); it('should raise error when Promise rejects', (done) => { diff --git a/packages/rxjs/spec/operators/skipUntil-spec.ts b/packages/rxjs/spec/operators/skipUntil-spec.ts index 65d5695ecd..e8c28eda8f 100644 --- a/packages/rxjs/spec/operators/skipUntil-spec.ts +++ b/packages/rxjs/spec/operators/skipUntil-spec.ts @@ -4,6 +4,7 @@ import { skipUntil, mergeMap, take } from 'rxjs/operators'; import { asInteropObservable } from '../helpers/interop-helper'; import { TestScheduler } from 'rxjs/testing'; import { observableMatcher } from '../helpers/observableMatcher'; +import * as sinon from 'sinon'; /** @test {skipUntil} */ describe('skipUntil', () => { @@ -369,6 +370,8 @@ describe('skipUntil', () => { }); it('should skip until Promise resolves', (done) => { + const sandbox = sinon.createSandbox(); + const fakeTimers = sandbox.useFakeTimers(); const e1 = interval(3).pipe(take(5)); const expected = [2, 3, 4]; @@ -379,9 +382,12 @@ describe('skipUntil', () => { error: () => done(new Error('should not be called')), complete: () => { expect(expected.length).to.equal(0); + sandbox.restore(); done(); }, }); + + fakeTimers.tickAsync(15); }); it('should raise error when Promise rejects', (done) => { diff --git a/packages/rxjs/spec/operators/window-spec.ts b/packages/rxjs/spec/operators/window-spec.ts index fb67cc7bac..ae58843649 100644 --- a/packages/rxjs/spec/operators/window-spec.ts +++ b/packages/rxjs/spec/operators/window-spec.ts @@ -4,6 +4,7 @@ import type { Observable} from 'rxjs'; import { EMPTY, of, interval } from 'rxjs'; import { observableMatcher } from '../helpers/observableMatcher'; import { expect } from 'chai'; +import * as sinon from 'sinon'; /** @test {window} */ describe('window', () => { @@ -284,6 +285,8 @@ describe('window', () => { }); it('should window when Promise resolves', (done) => { + const sandbox = sinon.createSandbox(); + const fakeTimers = sandbox.useFakeTimers(); const e1 = interval(3).pipe(take(5)); let pos = 0; const result: number[][] = [[], []]; @@ -302,9 +305,11 @@ describe('window', () => { error: () => done(new Error('should not be called')), complete: () => { expect(result).to.deep.equal(expected); + sandbox.restore(); done(); }, }); + fakeTimers.tickAsync(15); }); it('should raise error when Promise rejects', (done) => {