@@ -204,8 +204,33 @@ test('handle throws with resolved promise', function (t) {
204
204
var promise = Promise . resolve ( ) ;
205
205
a . throws ( promise ) ;
206
206
} ) . run ( ) . catch ( function ( err ) {
207
+ t . true ( err ) ;
207
208
t . is ( err . name , 'AssertionError' ) ;
209
+ t . end ( ) ;
210
+ } ) ;
211
+ } ) ;
212
+
213
+ test ( 'handle throws with regex' , function ( t ) {
214
+ ava ( function ( a ) {
215
+ a . plan ( 1 ) ;
216
+
217
+ var promise = Promise . reject ( new Error ( 'abc' ) ) ;
218
+ a . throws ( promise , / a b c / ) ;
219
+ } ) . run ( ) . then ( function ( a ) {
220
+ t . false ( a . assertionError ) ;
221
+ t . end ( ) ;
222
+ } ) ;
223
+ } ) ;
224
+
225
+ test ( 'handle throws with false-positive promise' , function ( t ) {
226
+ ava ( function ( a ) {
227
+ a . plan ( 1 ) ;
228
+
229
+ var promise = Promise . resolve ( new Error ( ) ) ;
230
+ a . throws ( promise ) ;
231
+ } ) . run ( ) . catch ( function ( err ) {
208
232
t . true ( err ) ;
233
+ t . is ( err . name , 'AssertionError' ) ;
209
234
t . end ( ) ;
210
235
} ) ;
211
236
} ) ;
@@ -218,8 +243,8 @@ test('handle doesNotThrow with error', function (t) {
218
243
219
244
a . end ( ) ;
220
245
} ) . run ( ) . catch ( function ( err ) {
221
- t . is ( err . name , 'AssertionError' ) ;
222
246
t . true ( err ) ;
247
+ t . is ( err . name , 'AssertionError' ) ;
223
248
t . end ( ) ;
224
249
} ) ;
225
250
} ) ;
@@ -257,6 +282,7 @@ test('handle doesNotThrow with rejected promise', function (t) {
257
282
a . doesNotThrow ( promise ) ;
258
283
} ) . run ( ) . catch ( function ( err ) {
259
284
t . true ( err ) ;
285
+ t . is ( err . name , 'AssertionError' ) ;
260
286
t . end ( ) ;
261
287
} ) ;
262
288
} ) ;
0 commit comments