@@ -11,9 +11,12 @@ describe('instanceOf', () => {
1111 }
1212 }
1313
14- expect ( instanceOf ( true , Foo ) ) . to . equal ( false ) ;
15- expect ( instanceOf ( null , Foo ) ) . to . equal ( false ) ;
16- expect ( instanceOf ( Object . create ( null ) , Foo ) ) . to . equal ( false ) ;
14+ expect ( instanceOf ( true , true , Foo ) ) . to . equal ( false ) ;
15+ expect ( instanceOf ( false , true , Foo ) ) . to . equal ( false ) ;
16+ expect ( instanceOf ( true , null , Foo ) ) . to . equal ( false ) ;
17+ expect ( instanceOf ( false , null , Foo ) ) . to . equal ( false ) ;
18+ expect ( instanceOf ( true , Object . create ( null ) , Foo ) ) . to . equal ( false ) ;
19+ expect ( instanceOf ( false , Object . create ( null ) , Foo ) ) . to . equal ( false ) ;
1720 } ) ;
1821
1922 it ( 'detect name clashes with older versions of this lib' , ( ) => {
@@ -33,8 +36,10 @@ describe('instanceOf', () => {
3336
3437 const NewClass = newVersion ( ) ;
3538 const OldClass = oldVersion ( ) ;
36- expect ( instanceOf ( new NewClass ( ) , NewClass ) ) . to . equal ( true ) ;
37- expect ( ( ) => instanceOf ( new OldClass ( ) , NewClass ) ) . to . throw ( ) ;
39+ expect ( instanceOf ( true , new NewClass ( ) , NewClass ) ) . to . equal ( true ) ;
40+ expect ( instanceOf ( false , new NewClass ( ) , NewClass ) ) . to . equal ( false ) ;
41+ expect ( ( ) => instanceOf ( true , new OldClass ( ) , NewClass ) ) . to . throw ( ) ;
42+ expect ( instanceOf ( false , new OldClass ( ) , NewClass ) ) . to . equal ( false ) ;
3843 } ) ;
3944
4045 it ( 'allows instances to have share the same constructor name' , ( ) => {
@@ -49,12 +54,16 @@ describe('instanceOf', () => {
4954
5055 const Foo = getMinifiedClass ( 'Foo' ) ;
5156 const Bar = getMinifiedClass ( 'Bar' ) ;
52- expect ( instanceOf ( new Foo ( ) , Bar ) ) . to . equal ( false ) ;
53- expect ( instanceOf ( new Bar ( ) , Foo ) ) . to . equal ( false ) ;
57+ expect ( instanceOf ( true , new Foo ( ) , Bar ) ) . to . equal ( false ) ;
58+ expect ( instanceOf ( false , new Foo ( ) , Bar ) ) . to . equal ( false ) ;
59+ expect ( instanceOf ( true , new Bar ( ) , Foo ) ) . to . equal ( false ) ;
60+ expect ( instanceOf ( false , new Bar ( ) , Foo ) ) . to . equal ( false ) ;
5461
5562 const DuplicateOfFoo = getMinifiedClass ( 'Foo' ) ;
56- expect ( ( ) => instanceOf ( new DuplicateOfFoo ( ) , Foo ) ) . to . throw ( ) ;
57- expect ( ( ) => instanceOf ( new Foo ( ) , DuplicateOfFoo ) ) . to . throw ( ) ;
63+ expect ( ( ) => instanceOf ( true , new DuplicateOfFoo ( ) , Foo ) ) . to . throw ( ) ;
64+ expect ( instanceOf ( false , new DuplicateOfFoo ( ) , Foo ) ) . to . equal ( false ) ;
65+ expect ( ( ) => instanceOf ( true , new Foo ( ) , DuplicateOfFoo ) ) . to . throw ( ) ;
66+ expect ( instanceOf ( false , new Foo ( ) , DuplicateOfFoo ) ) . to . equal ( false ) ;
5867 } ) ;
5968
6069 it ( 'fails with descriptive error message' , ( ) => {
@@ -69,11 +78,13 @@ describe('instanceOf', () => {
6978 const Foo1 = getFoo ( ) ;
7079 const Foo2 = getFoo ( ) ;
7180
72- expect ( ( ) => instanceOf ( new Foo1 ( ) , Foo2 ) ) . to . throw (
81+ expect ( ( ) => instanceOf ( true , new Foo1 ( ) , Foo2 ) ) . to . throw (
7382 / ^ C a n n o t u s e F o o " { } " f r o m a n o t h e r m o d u l e o r r e a l m ./ m,
7483 ) ;
75- expect ( ( ) => instanceOf ( new Foo2 ( ) , Foo1 ) ) . to . throw (
84+ expect ( instanceOf ( false , new Foo1 ( ) , Foo2 ) ) . to . equal ( false ) ;
85+ expect ( ( ) => instanceOf ( true , new Foo2 ( ) , Foo1 ) ) . to . throw (
7686 / ^ C a n n o t u s e F o o " { } " f r o m a n o t h e r m o d u l e o r r e a l m ./ m,
7787 ) ;
88+ expect ( instanceOf ( false , new Foo2 ( ) , Foo1 ) ) . to . equal ( false ) ;
7889 } ) ;
7990} ) ;
0 commit comments