@@ -33,7 +33,7 @@ class TestHolder implements DataHolder {
3333}
3434
3535describe ( "Connection Monitor" , ( ) => {
36- test ( "Receive invalid timestamp on initialization" , ( ) => {
36+ test ( "Receive invalid timestamp on initialization" , async ( ) => {
3737 const threshold : number = 10 ;
3838
3939 const handler = new TestHandler ( ) ;
@@ -51,13 +51,13 @@ describe("Connection Monitor", () => {
5151 expect ( handler . connectedCallCount ) . toBe ( 0 ) ;
5252 expect ( handler . disconnectedCallCount ) . toBe ( 0 ) ;
5353
54- expect ( monitor . run ( ) ) . toBeNull ( ) ;
54+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
5555
5656 expect ( handler . connected ) . toBe ( false ) ;
5757 expect ( handler . connectedCallCount ) . toBe ( 0 ) ;
5858 expect ( handler . disconnectedCallCount ) . toBe ( 0 ) ;
5959 } ) ;
60- test ( "Handle connect-disconnect" , ( ) => {
60+ test ( "Handle connect-disconnect" , async ( ) => {
6161 const threshold : number = 10 ;
6262
6363 const handler = new TestHandler ( ) ;
@@ -82,31 +82,31 @@ describe("Connection Monitor", () => {
8282 clock . ts = now ;
8383 monitor . notifyChanged ( ) ;
8484
85- expect ( monitor . run ( ) ) . toBeNull ( ) ;
86- expect ( monitor . run ( ) ) . toBeNull ( ) ;
87- expect ( monitor . run ( ) ) . toBeNull ( ) ;
85+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
86+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
87+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
8888
8989 expect ( handler . connected ) . toBe ( true ) ;
9090 expect ( handler . connectedCallCount ) . toBe ( 1 ) ;
9191 expect ( handler . disconnectedCallCount ) . toBe ( 0 ) ;
9292
9393 // Prepare for the disconnection process.
9494 clock . ts += threshold - 1 ;
95- expect ( monitor . run ( ) ) . toBeNull ( ) ;
95+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
9696 expect ( handler . connected ) . toBe ( true ) ;
9797 expect ( handler . connectedCallCount ) . toBe ( 1 ) ;
9898 expect ( handler . disconnectedCallCount ) . toBe ( 0 ) ;
9999
100100 // Begin the disconnection process.
101101 clock . ts += 1 ;
102- expect ( monitor . run ( ) ) . toBeNull ( ) ;
103- expect ( monitor . run ( ) ) . toBeNull ( ) ;
104- expect ( monitor . run ( ) ) . toBeNull ( ) ;
102+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
103+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
104+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
105105 expect ( handler . connected ) . toBe ( false ) ;
106106 expect ( handler . connectedCallCount ) . toBe ( 1 ) ;
107107 expect ( handler . disconnectedCallCount ) . toBe ( 1 ) ;
108108 } ) ;
109- test ( "Disconnected after receiving invalid timestamp" , ( ) => {
109+ test ( "Disconnected after receiving invalid timestamp" , async ( ) => {
110110 const threshold : number = 10 ;
111111
112112 const handler = new TestHandler ( ) ;
@@ -131,15 +131,15 @@ describe("Connection Monitor", () => {
131131 clock . ts = now ;
132132 monitor . notifyChanged ( ) ;
133133
134- expect ( monitor . run ( ) ) . toBeNull ( ) ;
134+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
135135
136136 expect ( handler . connected ) . toBe ( true ) ;
137137 expect ( handler . connectedCallCount ) . toBe ( 1 ) ;
138138 expect ( handler . disconnectedCallCount ) . toBe ( 0 ) ;
139139
140140 // Begin the disconnection process.
141141 holder . timestamp = - 1 ;
142- expect ( monitor . run ( ) ) . toBeNull ( ) ;
142+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
143143 expect ( handler . connected ) . toBe ( false ) ;
144144 expect ( handler . connectedCallCount ) . toBe ( 1 ) ;
145145 expect ( handler . disconnectedCallCount ) . toBe ( 1 ) ;
@@ -174,7 +174,7 @@ describe("Connection Monitor", () => {
174174 expect ( handler . connectedCallCount ) . toBe ( 1 ) ;
175175 expect ( handler . disconnectedCallCount ) . toBe ( 0 ) ;
176176 } ) ;
177- test ( "Ignore connection status updates on clock error" , ( ) => {
177+ test ( "Ignore connection status updates on clock error" , async ( ) => {
178178 const threshold : number = 10 ;
179179
180180 const handler = new TestHandler ( ) ;
@@ -205,11 +205,11 @@ describe("Connection Monitor", () => {
205205 expect ( handler . connectedCallCount ) . toBe ( 0 ) ;
206206 expect ( handler . disconnectedCallCount ) . toBe ( 0 ) ;
207207
208- expect ( monitor . run ( ) ) . toEqual ( new Error ( "invalid timestamp" ) ) ;
208+ expect ( await monitor . run ( ) ) . toStrictEqual ( new Error ( "invalid timestamp" ) ) ;
209209
210210 clock . error = null ;
211211 } ) ;
212- test ( "Ignore connection status updates when there is no data update timestamp" , ( ) => {
212+ test ( "Ignore connection status updates when there is no data update timestamp" , async ( ) => {
213213 const threshold : number = 10 ;
214214
215215 const handler = new TestHandler ( ) ;
@@ -240,11 +240,11 @@ describe("Connection Monitor", () => {
240240 expect ( handler . connectedCallCount ) . toBe ( 0 ) ;
241241 expect ( handler . disconnectedCallCount ) . toBe ( 0 ) ;
242242
243- expect ( monitor . run ( ) ) . toEqual ( new Error ( "invalid timestamp" ) ) ;
243+ expect ( await monitor . run ( ) ) . toStrictEqual ( new Error ( "invalid timestamp" ) ) ;
244244
245245 clock . error = null ;
246246
247- expect ( monitor . run ( ) ) . toBeNull ( ) ;
247+ expect ( await monitor . run ( ) ) . toBeNull ( ) ;
248248 expect ( handler . connected ) . toBe ( false ) ;
249249 expect ( handler . connectedCallCount ) . toBe ( 0 ) ;
250250 expect ( handler . disconnectedCallCount ) . toBe ( 0 ) ;
0 commit comments