File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -130,13 +130,10 @@ describe("poll-action", () => {
130130 } ) ;
131131
132132 // WHEN
133- try {
134- await timeout ( updateInterval , maxDuration , action ) ;
135- } catch ( e ) {
136- expect ( e ) . toEqual ( `Action timed out after ${ maxDuration } ms` ) ;
137- }
133+ const SUT = ( ) => timeout ( updateInterval , maxDuration , action ) ;
138134
139135 // THEN
136+ await expect ( SUT ) . rejects . toBe ( `Action timed out after ${ maxDuration } ms` ) ;
140137 expect ( action ) . toBeCalledTimes ( 1 ) ;
141138 } ) ;
142139
@@ -153,13 +150,10 @@ describe("poll-action", () => {
153150 } ) ;
154151
155152 // WHEN
156- try {
157- await timeout ( updateInterval , maxDuration , action ) ;
158- } catch ( e ) {
159- expect ( e ) . toBe ( `Action timed out after ${ maxDuration } ms` ) ;
160- }
153+ const SUT = ( ) => timeout ( updateInterval , maxDuration , action ) ;
161154
162155 // THEN
156+ await expect ( SUT ) . rejects . toBe ( `Action timed out after ${ maxDuration } ms` ) ;
163157 expect ( action ) . toBeCalledTimes ( 1 ) ;
164158 setTimeout ( ( ) => {
165159 expect ( action ) . toBeCalledTimes ( 1 ) ;
You can’t perform that action at this time.
0 commit comments