@@ -41,6 +41,42 @@ describe("raven-for-redux", () => {
41
41
context . middleware = createRavenMiddleware ( Raven ) ;
42
42
context . store = createStore ( reducer , applyMiddleware ( context . middleware ) ) ;
43
43
} ) ;
44
+ it ( "merges Redux info with existing 'extras'" , ( ) => {
45
+ Raven . captureException ( new Error ( "Crash!" ) , {
46
+ extra : { anotherValue : 10 }
47
+ } ) ;
48
+ const { extra } = context . mockTransport . mock . calls [ 0 ] [ 0 ] . data ;
49
+ expect ( extra ) . toMatchObject ( {
50
+ state : { value : 0 } ,
51
+ lastAction : undefined ,
52
+ anotherValue : 10
53
+ // session:duration will also be defined
54
+ } ) ;
55
+ } ) ;
56
+ it ( "if explicitly passed extras contain a `state` property, the explicit version wins" , ( ) => {
57
+ Raven . captureException ( new Error ( "Crash!" ) , {
58
+ extra : { anotherValue : 10 , state : "SOME OTHER STATE" }
59
+ } ) ;
60
+ const { extra } = context . mockTransport . mock . calls [ 0 ] [ 0 ] . data ;
61
+ expect ( extra ) . toMatchObject ( {
62
+ state : "SOME OTHER STATE" ,
63
+ lastAction : undefined ,
64
+ anotherValue : 10
65
+ // session:duration will also be defined
66
+ } ) ;
67
+ } ) ;
68
+ it ( "if explicitly passed extras contain a `lastAction` property, the explicit version wins" , ( ) => {
69
+ Raven . captureException ( new Error ( "Crash!" ) , {
70
+ extra : { anotherValue : 10 , lastAction : "SOME OTHER LAST ACTION" }
71
+ } ) ;
72
+ const { extra } = context . mockTransport . mock . calls [ 0 ] [ 0 ] . data ;
73
+ expect ( extra ) . toMatchObject ( {
74
+ state : { value : 0 } ,
75
+ lastAction : "SOME OTHER LAST ACTION" ,
76
+ anotherValue : 10
77
+ // session:duration will also be defined
78
+ } ) ;
79
+ } ) ;
44
80
it ( "includes the initial state when crashing/messaging before any action has been dispatched" , ( ) => {
45
81
Raven . captureMessage ( "report!" ) ;
46
82
0 commit comments