File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 15
15
"build:watch" : " run-p build:cjs:watch build:esm:watch" ,
16
16
"clean" : " rimraf dist coverage" ,
17
17
"link:yarn" : " yarn link" ,
18
- "test" : " jest --passWithNoTests " ,
18
+ "test" : " jest" ,
19
19
"test:watch" : " jest --watch"
20
20
},
21
21
"dependencies" : {
Original file line number Diff line number Diff line change
1
+ import { AppsignalErrorHandler } from "../index"
2
+
3
+ describe ( "Angular handleError" , ( ) => {
4
+ let appsignal : any
5
+
6
+ const mock : any = {
7
+ setError : jest . fn ( ( ) => mock ) ,
8
+ setTags : jest . fn ( ( ) => mock )
9
+ }
10
+
11
+ const SpanMock = jest . fn ( ) . mockImplementation ( ( ) => mock )
12
+
13
+ beforeEach ( ( ) => {
14
+ appsignal = {
15
+ createSpan : ( ) => new SpanMock ( ) ,
16
+ send : jest . fn ( )
17
+ }
18
+ } )
19
+
20
+ it ( "calls AppSignal helper methods" , ( ) => {
21
+ const err = new Error ( "test" )
22
+ const errorHandler = new AppsignalErrorHandler ( appsignal )
23
+
24
+ errorHandler . handleError ( err )
25
+
26
+ expect ( mock . setError ) . toBeCalledWith ( err )
27
+ expect ( mock . setTags ) . toBeCalledWith ( {
28
+ framework : "Angular"
29
+ } )
30
+
31
+ expect ( appsignal . send ) . toBeCalledWith ( mock )
32
+ } )
33
+ } )
You can’t perform that action at this time.
0 commit comments