@@ -64,19 +64,17 @@ describe("$interval", () => {
64
64
} , 2 ) ;
65
65
} ) ;
66
66
67
- it ( "should NOT call $evalAsync or $digest if invokeApply is set to false" , ( done ) => {
67
+ it ( "should NOT call $evalAsync or $digest if invokeApply is set to false" , async ( ) => {
68
68
const evalAsyncSpy = spyOn ( $rootScope , "$evalAsync" ) . and . callThrough ( ) ;
69
69
const digestSpy = spyOn ( $rootScope , "$digest" ) . and . callThrough ( ) ;
70
70
const notifySpy = jasmine . createSpy ( "notify" ) ;
71
71
72
72
$interval ( notifySpy , 1 , 1 , false ) ;
73
73
74
- setTimeout ( ( ) => {
75
- expect ( notifySpy ) . toHaveBeenCalled ( ) ;
76
- expect ( evalAsyncSpy ) . not . toHaveBeenCalled ( ) ;
77
- expect ( digestSpy ) . not . toHaveBeenCalled ( ) ;
78
- done ( ) ;
79
- } , 3 ) ;
74
+ await wait ( 10 ) ;
75
+ expect ( notifySpy ) . toHaveBeenCalled ( ) ;
76
+ expect ( evalAsyncSpy ) . not . toHaveBeenCalled ( ) ;
77
+ expect ( digestSpy ) . not . toHaveBeenCalled ( ) ;
80
78
} ) ;
81
79
82
80
it ( "should allow you to specify a number of iterations" , async ( ) => {
@@ -139,10 +137,10 @@ describe("$interval", () => {
139
137
expect ( log ) . toEqual ( [ ] ) ;
140
138
141
139
await wait ( 5 ) ;
142
- expect ( log [ 0 ] ) . toEqual ( "tick" ) ;
143
- expect ( log [ 1 ] ) . toEqual ( "promise update: 0" ) ;
144
- expect ( log [ 2 ] ) . toEqual ( "tick" ) ;
145
- expect ( log [ 3 ] ) . toEqual ( "promise update: 1" ) ;
140
+ expect ( log [ 0 ] ) . toEqual ( "tick" ) ;
141
+ expect ( log [ 1 ] ) . toEqual ( "promise update: 0" ) ;
142
+ expect ( log [ 2 ] ) . toEqual ( "tick" ) ;
143
+ expect ( log [ 3 ] ) . toEqual ( "promise update: 1" ) ;
146
144
} ) ;
147
145
148
146
it ( "should return a promise which will be resolved after the specified number of iterations" , async ( ) => {
0 commit comments