File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { expect } from 'chai' ;
9
+ import { describe , it } from 'mocha' ;
10
+ import instanceOf from '../instanceOf' ;
11
+
12
+ describe ( 'instanceOf' , ( ) => {
13
+ it ( 'fails with descriptive error message' , ( ) => {
14
+ function getFoo ( ) {
15
+ class Foo { }
16
+ return Foo ;
17
+ }
18
+ const Foo1 = getFoo ( ) ;
19
+ const Foo2 = getFoo ( ) ;
20
+
21
+ expect ( ( ) => instanceOf ( new Foo1 ( ) , Foo2 ) ) . to . throw (
22
+ / ^ C a n n o t u s e F o o " \[ o b j e c t O b j e c t \] " 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,
23
+ ) ;
24
+ expect ( ( ) => instanceOf ( new Foo2 ( ) , Foo1 ) ) . to . throw (
25
+ / ^ C a n n o t u s e F o o " \[ o b j e c t O b j e c t \] " 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,
26
+ ) ;
27
+ } ) ;
28
+ } ) ;
You can’t perform that action at this time.
0 commit comments