@@ -83,12 +83,15 @@ describe('utils', () => {
8383 Duration . from ( { seconds : 1 } ) ,
8484 ) ;
8585 fakeTimers . tick ( 500 ) ;
86- try {
87- const result = await awaitPromise ;
88- assert . deepStrictEqual ( result , [ testString , false ] ) ;
89- } catch ( e ) {
90- assert . strictEqual ( e , null , 'timeout was triggered, improperly' ) ;
91- }
86+
87+ const result = await awaitPromise ;
88+ assert . strictEqual ( result . returnedValue , testString ) ;
89+ assert . strictEqual ( result . exception , undefined ) ;
90+ assert . strictEqual (
91+ result . timedOut ,
92+ false ,
93+ 'timeout was triggered, improperly' ,
94+ ) ;
9295 } ) ;
9396
9497 it ( 'handles non-timeout errors properly' , async ( ) => {
@@ -104,12 +107,14 @@ describe('utils', () => {
104107 Duration . from ( { seconds : 1 } ) ,
105108 ) ;
106109 fakeTimers . tick ( 500 ) ;
107- try {
108- const result = await awaitPromise ;
109- assert . strictEqual ( result , null , 'non-error was triggered, improperly' ) ;
110- } catch ( e ) {
111- assert . deepStrictEqual ( e , [ testString , false ] ) ;
112- }
110+
111+ const result = await awaitPromise ;
112+ assert . strictEqual (
113+ result . exception ,
114+ testString ,
115+ 'non-error was triggered, improperly' ,
116+ ) ;
117+ assert . strictEqual ( result . timedOut , false ) ;
113118 } ) ;
114119
115120 it ( 'handles timeout properly' , async ( ) => {
@@ -125,17 +130,15 @@ describe('utils', () => {
125130 Duration . from ( { seconds : 1 } ) ,
126131 ) ;
127132 fakeTimers . tick ( 1500 ) ;
128- try {
129- const result = await awaitPromise ;
130- assert . strictEqual (
131- result ,
132- null ,
133- 'timeout was not triggered, improperly' ,
134- ) ;
135- } catch ( e ) {
136- const err : unknown [ ] = e as unknown [ ] ;
137- assert . strictEqual ( err [ 1 ] , true ) ;
138- }
133+
134+ const result = await awaitPromise ;
135+ assert . strictEqual (
136+ result . timedOut ,
137+ true ,
138+ 'timeout was not triggered, improperly' ,
139+ ) ;
140+
141+ assert . strictEqual ( result . timedOut , true ) ;
139142 } ) ;
140143 } ) ;
141144} ) ;
0 commit comments