1
1
import { queueScheduler } from '@rx-angular/cdk/zone-less/rxjs' ;
2
2
import { Subscription , merge } from 'rxjs' ;
3
3
import { delay } from 'rxjs/operators' ;
4
+ import { intervalProvider } from '../../src/internals/intervalProvider' ;
4
5
import { RxTestScheduler } from '../../src/testing/test-scheduler' ;
5
6
import { jestMatcher } from '@test-helpers' ;
6
7
@@ -12,10 +13,9 @@ describe('Scheduler.queue', () => {
12
13
13
14
beforeEach ( ( ) => {
14
15
testScheduler = new RxTestScheduler ( jestMatcher ) ;
15
- } ) ;
16
-
17
- afterEach ( ( ) => {
16
+ jest . clearAllTimers ( ) ;
18
17
jest . useRealTimers ( ) ;
18
+ jest . clearAllMocks ( ) ;
19
19
} ) ;
20
20
21
21
it ( 'should act like the async scheduler if delay > 0' , ( ) => {
@@ -33,6 +33,10 @@ describe('Scheduler.queue', () => {
33
33
34
34
it ( 'should switch from synchronous to asynchronous at will' , ( ) => {
35
35
jest . useFakeTimers ( ) ;
36
+ intervalProvider . delegate = {
37
+ setInterval : setInterval ,
38
+ clearInterval : clearInterval ,
39
+ } ;
36
40
37
41
let asyncExec = false ;
38
42
const state : Array < number > = [ ] ;
@@ -58,6 +62,7 @@ describe('Scheduler.queue', () => {
58
62
59
63
expect ( asyncExec ) . toBe ( true ) ;
60
64
expect ( state ) . toEqual ( [ 0 , 1 , 2 ] ) ;
65
+ intervalProvider . delegate = undefined ;
61
66
} ) ;
62
67
63
68
it ( 'should unsubscribe the rest of the scheduled actions if an action throws an error' , ( ) => {
0 commit comments