Skip to content

Commit

Permalink
test(TestScheduler): add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed May 17, 2018
1 parent 537fe7d commit 4b68933
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/schedulers/TestScheduler-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect } from 'chai';
import { hot, cold, expectObservable, expectSubscriptions, time } from '../helpers/marble-testing';
import { AsyncScheduler } from 'rxjs/internal/scheduler/AsyncScheduler';
import { TestScheduler } from 'rxjs/testing';
import { Observable, NEVER, EMPTY, Subject, of, concat, merge, Notification } from 'rxjs';
import { delay, debounceTime, concatMap } from 'rxjs/operators';
Expand Down Expand Up @@ -441,5 +442,25 @@ describe('TestScheduler', () => {
done();
});
});

it('should restore changes upon thrown errors', () => {
const testScheduler = new TestScheduler(assertDeepEquals);

const frameTimeFactor = TestScheduler['frameTimeFactor'];
const maxFrames = testScheduler.maxFrames;
const runMode = testScheduler['runMode'];
const delegate = AsyncScheduler.delegate;

try {
testScheduler.run(() => {
throw new Error('kaboom!');
});
} catch { /* empty */ }

expect(TestScheduler['frameTimeFactor']).to.equal(frameTimeFactor);
expect(testScheduler.maxFrames).to.equal(maxFrames);
expect(testScheduler['runMode']).to.equal(runMode);
expect(AsyncScheduler.delegate).to.equal(delegate);
});
});
});

0 comments on commit 4b68933

Please sign in to comment.