@@ -391,6 +391,29 @@ describe('expect', function () {
391
391
expect ( function * ( ) { } ) . to . be . callable ;
392
392
expect ( async function * ( ) { } ) . to . be . callable ;
393
393
394
+ expect ( 'foobar' ) . to . not . be . callable ;
395
+
396
+ err ( function ( ) {
397
+ expect ( 'foobar' , 'blah' ) . to . be . callable ;
398
+ } , "blah: expected 'foobar' to be a callable function" ) ;
399
+
400
+ err ( function ( ) {
401
+ expect ( function ( ) { } , 'blah' ) . to . not . be . callable ;
402
+ } , "blah: expected [Function] not to be a callable function" ) ;
403
+ } ) ;
404
+
405
+ it ( 'function' , function ( ) {
406
+ expect ( function ( ) { } ) . to . be . a ( 'function' ) ;
407
+ expect ( async function ( ) { } ) . to . be . a ( 'function' ) ;
408
+ expect ( function * ( ) { } ) . to . be . a ( 'function' ) ;
409
+ expect ( async function * ( ) { } ) . to . be . a ( 'function' ) ;
410
+
411
+ expect ( 'foobar' ) . to . not . be . a ( 'function' ) ;
412
+
413
+ err ( function ( ) {
414
+ expect ( 'foobar' ) . to . be . a ( 'function' , 'blah' ) ;
415
+ } , "blah: expected 'foobar' to be a function" ) ;
416
+
394
417
err ( function ( ) {
395
418
expect ( function ( ) { } ) . to . not . be . a ( 'function' , 'blah' ) ;
396
419
} , "blah: expected [Function] not to be a function" ) ;
@@ -404,6 +427,10 @@ describe('expect', function () {
404
427
expect ( async function ( ) { } ) . to . be . a ( 'AsyncFunction' ) ;
405
428
expect ( async function * ( ) { } ) . to . be . a ( 'AsyncFunction' ) ;
406
429
430
+ err ( function ( ) {
431
+ expect ( 'foobar' ) . to . be . a ( 'asyncfunction' , 'blah' ) ;
432
+ } , "blah: expected 'foobar' to be an asyncfunction" ) ;
433
+
407
434
err ( function ( ) {
408
435
expect ( async function ( ) { } ) . to . not . be . a ( 'asyncfunction' , 'blah' ) ;
409
436
} , "blah: expected [AsyncFunction] not to be an asyncfunction" ) ;
@@ -417,6 +444,10 @@ describe('expect', function () {
417
444
expect ( function * ( ) { } ) . to . be . a ( 'generatorFunction' ) ;
418
445
expect ( async function * ( ) { } ) . to . be . a ( 'generatorFunction' ) ;
419
446
447
+ err ( function ( ) {
448
+ expect ( 'foobar' ) . to . be . a ( 'generatorfunction' , 'blah' ) ;
449
+ } , "blah: expected 'foobar' to be a generatorfunction" ) ;
450
+
420
451
err ( function ( ) {
421
452
expect ( function * ( ) { } ) . to . not . be . a ( 'generatorfunction' , 'blah' ) ;
422
453
} , "blah: expected [GeneratorFunction] not to be a generatorfunction" ) ;
@@ -429,6 +460,10 @@ describe('expect', function () {
429
460
it ( 'asyncGeneratorFunction' , function ( ) {
430
461
expect ( async function * ( ) { } ) . to . be . a ( 'asyncGeneratorFunction' ) ;
431
462
463
+ err ( function ( ) {
464
+ expect ( async function ( ) { } , 'blah' ) . to . be . a ( 'asyncgeneratorfunction' ) ;
465
+ } , "blah: expected [AsyncFunction] to be an asyncgeneratorfunction" ) ;
466
+
432
467
err ( function ( ) {
433
468
expect ( async function * ( ) { } , 'blah' ) . to . not . be . a ( 'asyncgeneratorfunction' ) ;
434
469
} , "blah: expected [AsyncGeneratorFunction] not to be an asyncgeneratorfunction" ) ;
@@ -456,8 +491,8 @@ describe('expect', function () {
456
491
err ( function ( ) {
457
492
expect ( new Foo ( ) , 'blah' ) . to . an . instanceof ( 1 ) ;
458
493
} , "blah: The instanceof assertion needs a constructor but Number was given." ) ;
459
- err ( function ( ) {
460
494
495
+ err ( function ( ) {
461
496
expect ( new Foo ( ) ) . to . an . instanceof ( 'batman' ) ;
462
497
} , "The instanceof assertion needs a constructor but String was given." ) ;
463
498
0 commit comments