Skip to content

Commit 6ada7a5

Browse files
committed
fix(sandboxinstance): expose scheduler instance
BREAKING CHANGE: scheduler no longer expose `maxFrame` property. use property returned by `sandbox.create()`.
1 parent b24ae36 commit 6ada7a5

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/interfaces/RxSandboxInstance.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { SubscriptionLog } from '../utils/coreInternalImport';
66
* Sandbox instance with test scheduler. All actions scheduled via scheduler
77
* will be flushed synchronously.
88
*/
9-
interface RxSandboxInstance extends Omit<SchedulerInstance, 'scheduler'> {
9+
interface RxSandboxInstance extends SchedulerInstance {
1010
e: expectedObservable;
1111
/**
1212
* Utility function to generate `expected` subscriptions via marble diagram.
@@ -25,7 +25,7 @@ interface RxSandboxInstance extends Omit<SchedulerInstance, 'scheduler'> {
2525
* @experimental Not a final implementation. Either interface or implementation can change
2626
* without major breaking version bump.
2727
*/
28-
interface RxAsyncSandboxInstance extends Omit<AsyncSchedulerInstance, 'scheduler'> {
28+
interface RxAsyncSandboxInstance extends AsyncSchedulerInstance {
2929
e: expectedObservable;
3030
/**
3131
* Utility function to generate `expected` subscriptions via marble diagram.

src/scheduler/createTestScheduler.ts

+3-14
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function createGetMessages(state: SandboxState, flush: Function): Function {
286286

287287
const initializeSandboxState = (autoFlush: boolean, frameTimeFactor: number, maxFrameValue: number): SandboxState => {
288288
const maxFrame = maxFrameValue * frameTimeFactor;
289-
const result = {
289+
return {
290290
coldObservables: [],
291291
hotObservables: [],
292292
flushed: false,
@@ -296,23 +296,13 @@ const initializeSandboxState = (autoFlush: boolean, frameTimeFactor: number, max
296296
scheduler: new VirtualTimeScheduler(VirtualAction, Number.POSITIVE_INFINITY),
297297
autoFlush
298298
};
299-
300-
// @deprecated: will be deprecated, use return value of createScheduler instead
301-
(result.scheduler as any).maxFrame = maxFrame;
302-
return result;
303299
};
304300

305301
interface BaseSchedulerInstance {
306302
/**
307303
* Test scheduler created for sandbox instance
308304
*/
309-
scheduler: SchedulerLike & {
310-
/**
311-
* @deprecated: Testscheduler will not expose this property anymore.
312-
* Use return value from createTestScheduler instead.
313-
*/
314-
maxFrame: number;
315-
};
305+
scheduler: SchedulerLike;
316306

317307
/**
318308
* Creates a hot observable using marble diagram DSL, or TestMessage.
@@ -374,8 +364,7 @@ function createTestScheduler(autoFlush: boolean, frameTimeFactor: number, maxFra
374364
const flush = () => flushUntil();
375365

376366
return {
377-
//todo: remove casting once maxFrame is deprecated
378-
scheduler: sandboxState.scheduler as any,
367+
scheduler: sandboxState.scheduler,
379368
advanceTo,
380369
getMessages: createGetMessages(sandboxState, flush),
381370
cold: getCreateColdObservable(sandboxState),

0 commit comments

Comments
 (0)