@@ -4,9 +4,8 @@ describe('errorHandler', () => {
44 const errorString = 'errorString'
55 const info = 'additional info provided by vue'
66 const errorObject = new Error ( errorString )
7-
87 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 )
109 } )
1110
1211 it ( 'when error object: rethrown error contains vue info when provided' , ( ) => {
@@ -17,8 +16,15 @@ describe('errorHandler', () => {
1716 } )
1817 } )
1918
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+
2026 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 )
2228 } )
2329
2430 it ( 'throws error with string and appends info when provided' , ( ) => {
@@ -28,4 +34,12 @@ describe('errorHandler', () => {
2834 return errorMessage . includes ( errorString ) && errorMessage . includes ( info )
2935 } )
3036 } )
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+ } )
3145} )
0 commit comments