File tree 1 file changed +4
-10
lines changed
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -130,13 +130,10 @@ describe("poll-action", () => {
130
130
} ) ;
131
131
132
132
// 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 ) ;
138
134
139
135
// THEN
136
+ await expect ( SUT ) . rejects . toBe ( `Action timed out after ${ maxDuration } ms` ) ;
140
137
expect ( action ) . toBeCalledTimes ( 1 ) ;
141
138
} ) ;
142
139
@@ -153,13 +150,10 @@ describe("poll-action", () => {
153
150
} ) ;
154
151
155
152
// 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 ) ;
161
154
162
155
// THEN
156
+ await expect ( SUT ) . rejects . toBe ( `Action timed out after ${ maxDuration } ms` ) ;
163
157
expect ( action ) . toBeCalledTimes ( 1 ) ;
164
158
setTimeout ( ( ) => {
165
159
expect ( action ) . toBeCalledTimes ( 1 ) ;
You can’t perform that action at this time.
0 commit comments