@@ -43,9 +43,9 @@ describe('Throttler class', () => {
4343 await ensureHasRecentRun ( ) ;
4444 void throttler . schedule ( process ) ;
4545
46- assert . isFalse ( process . called ) ;
46+ sinon . assert . notCalled ( process ) ;
4747 await clock . tickAsync ( TIMEOUT + 1 ) ;
48- assert . isTrue ( process . calledOnce ) ;
48+ sinon . assert . calledOnce ( process ) ;
4949 } ) ;
5050
5151 it ( 'is able to schedule a process from process' , async ( ) => {
@@ -58,14 +58,14 @@ describe('Throttler class', () => {
5858 await ensureHasRecentRun ( ) ;
5959 void throttler . schedule ( process1 ) ;
6060
61- assert . isFalse ( process1 . called ) ;
61+ sinon . assert . notCalled ( process1 ) ;
6262 assert . isFalse ( process2 . calledOnce ) ;
6363 await clock . tickAsync ( TIMEOUT + 1 ) ;
64- assert . isTrue ( process1 . calledOnce ) ;
64+ sinon . assert . calledOnce ( process1 ) ;
6565 assert . isFalse ( process2 . calledOnce ) ;
6666 await clock . tickAsync ( TIMEOUT + 1 ) ;
67- assert . isTrue ( process1 . calledOnce ) ;
68- assert . isTrue ( process2 . calledOnce ) ;
67+ sinon . assert . calledOnce ( process1 ) ;
68+ sinon . assert . calledOnce ( process2 ) ;
6969 } ) ;
7070
7171 it ( 'is able to schedule a process as soon as possible' , async ( ) => {
@@ -75,9 +75,9 @@ describe('Throttler class', () => {
7575 await ensureHasRecentRun ( ) ;
7676 void throttler . schedule ( process , Scheduling . AS_SOON_AS_POSSIBLE ) ;
7777
78- assert . isFalse ( process . called ) ;
78+ sinon . assert . notCalled ( process ) ;
7979 await clock . tickAsync ( 0 ) ;
80- assert . isTrue ( process . calledOnce ) ;
80+ sinon . assert . calledOnce ( process ) ;
8181 } ) ;
8282
8383 it ( 'is able to schedule two processes as soon as possible' , async ( ) => {
@@ -89,12 +89,12 @@ describe('Throttler class', () => {
8989 const promiseTest = throttler . schedule ( process1 , Scheduling . AS_SOON_AS_POSSIBLE ) ;
9090 void throttler . schedule ( process2 , Scheduling . AS_SOON_AS_POSSIBLE ) ;
9191
92- assert . isFalse ( process1 . called ) ;
93- assert . isFalse ( process2 . called ) ;
92+ sinon . assert . notCalled ( process1 ) ;
93+ sinon . assert . notCalled ( process2 ) ;
9494 void clock . tickAsync ( 0 ) ;
9595 await promiseTest ;
96- assert . isFalse ( process1 . called ) ;
97- assert . isTrue ( process2 . calledOnce ) ;
96+ sinon . assert . notCalled ( process1 ) ;
97+ sinon . assert . calledOnce ( process2 ) ;
9898 } ) ;
9999
100100 it ( 'by default schedules a process delayed only if another process ran recently' , async ( ) => {
@@ -103,26 +103,26 @@ describe('Throttler class', () => {
103103 throttler = new Throttler ( TIMEOUT ) ;
104104 void throttler . schedule ( process ) ;
105105
106- assert . isFalse ( process . called ) ;
106+ sinon . assert . notCalled ( process ) ;
107107 await clock . tickAsync ( 0 ) ;
108- assert . isTrue ( process . calledOnce ) ;
108+ sinon . assert . calledOnce ( process ) ;
109109 process . resetHistory ( ) ;
110110
111111 void throttler . schedule ( process ) ;
112112 await clock . tickAsync ( 0 ) ;
113- assert . isFalse ( process . called ) ;
113+ sinon . assert . notCalled ( process ) ;
114114 await clock . tickAsync ( TIMEOUT / 2 ) ;
115- assert . isFalse ( process . called ) ;
115+ sinon . assert . notCalled ( process ) ;
116116 void throttler . schedule ( process ) ;
117117 await clock . tickAsync ( TIMEOUT / 2 ) ;
118- assert . isTrue ( process . calledOnce ) ;
118+ sinon . assert . calledOnce ( process ) ;
119119
120120 await ensureNoRecentRun ( ) ;
121121 process . resetHistory ( ) ;
122122 void throttler . schedule ( process ) ;
123- assert . isFalse ( process . called ) ;
123+ sinon . assert . notCalled ( process ) ;
124124 await clock . tickAsync ( 0 ) ;
125- assert . isTrue ( process . calledOnce ) ;
125+ sinon . assert . calledOnce ( process ) ;
126126 } ) ;
127127
128128 it ( 'is able to schedule a delayed process' , async ( ) => {
@@ -131,11 +131,11 @@ describe('Throttler class', () => {
131131 const throttler = new Throttler ( TIMEOUT ) ;
132132 void throttler . schedule ( process , Scheduling . DELAYED ) ;
133133
134- assert . isFalse ( process . called ) ;
134+ sinon . assert . notCalled ( process ) ;
135135 await clock . tickAsync ( 0 ) ;
136- assert . isFalse ( process . called ) ;
136+ sinon . assert . notCalled ( process ) ;
137137 await clock . tickAsync ( TIMEOUT ) ;
138- assert . isTrue ( process . calledOnce ) ;
138+ sinon . assert . calledOnce ( process ) ;
139139 } ) ;
140140
141141 it ( 'runs only one process at a time' , async ( ) => {
@@ -157,18 +157,18 @@ describe('Throttler class', () => {
157157 void throttler . schedule ( process1 , Scheduling . AS_SOON_AS_POSSIBLE ) ;
158158
159159 await clock . tickAsync ( 0 ) ;
160- assert . isTrue ( spy1 . called ) ;
160+ sinon . assert . called ( spy1 ) ;
161161
162162 void throttler . schedule ( process2 ) ;
163163 await clock . tickAsync ( 100 ) ;
164- assert . isFalse ( spy2 . called ) ;
164+ sinon . assert . notCalled ( spy2 ) ;
165165
166166 process1Resolve ( ) ;
167167 await clock . tickAsync ( 0 ) ;
168- assert . isFalse ( spy2 . called ) ;
168+ sinon . assert . notCalled ( spy2 ) ;
169169
170170 await clock . tickAsync ( 50 ) ;
171- assert . isTrue ( spy2 . called ) ;
171+ sinon . assert . called ( spy2 ) ;
172172
173173 process2Resolve ( ) ; // No pending promises.
174174 } ) ;
@@ -179,12 +179,12 @@ describe('Throttler class', () => {
179179 const throttler = new Throttler ( TIMEOUT ) ;
180180 const promise = throttler . schedule ( process , Scheduling . DELAYED ) ;
181181
182- assert . isTrue ( process . notCalled ) ;
182+ sinon . assert . notCalled ( process ) ;
183183 await clock . tickAsync ( TIMEOUT + 1 ) ;
184- assert . isTrue ( process . calledOnce ) ;
184+ sinon . assert . calledOnce ( process ) ;
185185 const race = await Promise . race ( [ promise , Promise . resolve ( 'pending' ) ] ) ;
186186 assert . notStrictEqual ( race , 'pending' ) ;
187- assert . isTrue ( consoleStub . calledOnce ) ;
187+ sinon . assert . calledOnce ( consoleStub ) ;
188188 } ) ;
189189
190190 it ( 'is resolve promise correctly' , async ( ) => {
@@ -222,6 +222,6 @@ describe('Throttler class', () => {
222222 await clock . tickAsync ( TIMEOUT + 1 ) ;
223223 assert . isFalse ( process1 . calledOnce ) ;
224224 assert . isFalse ( process2 . calledOnce ) ;
225- assert . isTrue ( process3 . calledOnce ) ;
225+ sinon . assert . calledOnce ( process3 ) ;
226226 } ) ;
227227} ) ;
0 commit comments