@@ -4,9 +4,8 @@ describe('errorHandler', () => {
4
4
const errorString = 'errorString'
5
5
const info = 'additional info provided by vue'
6
6
const errorObject = new Error ( errorString )
7
-
8
7
it ( 'when error object: rethrows error' , ( ) => {
9
- expect ( ( ) => errorHandler ( errorObject ) ) . to . throw ( ) . with . property ( 'message' , errorString )
8
+ expect ( ( ) => errorHandler ( errorObject , { } ) ) . to . throw ( ) . with . property ( 'message' , errorString )
10
9
} )
11
10
12
11
it ( 'when error object: rethrown error contains vue info when provided' , ( ) => {
@@ -17,8 +16,15 @@ describe('errorHandler', () => {
17
16
} )
18
17
} )
19
18
19
+ it ( 'when error object: sets vm_error to the error that is thrown' , ( ) => {
20
+ const vm = { }
21
+ expect ( ( ) => errorHandler ( errorObject , vm , info ) ) . to . throw ( ) . that . satisfies ( function ( err ) {
22
+ return err === vm . _error
23
+ } )
24
+ } )
25
+
20
26
it ( 'when error string: throws error with string' , ( ) => {
21
- expect ( ( ) => errorHandler ( errorString ) ) . to . throw ( ) . with . property ( 'message' , errorString )
27
+ expect ( ( ) => errorHandler ( errorString , { } ) ) . to . throw ( ) . with . property ( 'message' , errorString )
22
28
} )
23
29
24
30
it ( 'throws error with string and appends info when provided' , ( ) => {
@@ -28,4 +34,12 @@ describe('errorHandler', () => {
28
34
return errorMessage . includes ( errorString ) && errorMessage . includes ( info )
29
35
} )
30
36
} )
37
+
38
+ it ( 'when error string: sets vm_error to the error that is thrown' , ( ) => {
39
+ const vm = { }
40
+
41
+ expect ( ( ) => errorHandler ( errorObject , vm , info ) ) . to . throw ( ) . that . satisfies ( function ( err ) {
42
+ return err === vm . _error
43
+ } )
44
+ } )
31
45
} )
0 commit comments