File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ export class Session implements SessionInterface {
115
115
did : typeof this . did === 'number' || typeof this . did === 'string' ? `${ this . did } ` : undefined ,
116
116
duration : this . duration ,
117
117
attrs : dropUndefinedKeys ( {
118
- release : this . release ,
118
+ release : typeof this . release !== 'string' ? JSON . stringify ( this . release ) : this . release ,
119
119
environment : this . environment ,
120
120
ip_address : this . ipAddress ,
121
121
user_agent : this . userAgent ,
Original file line number Diff line number Diff line change
1
+ import { Session } from '../src' ;
2
+
3
+ describe ( 'Session' , ( ) => {
4
+ test ( 'Release of type object is stringified in toJSON()' , ( ) => {
5
+ const session = new Session ( {
6
+ // @ts -ignore
7
+ release : { name : 'whatever' } ,
8
+ } ) ;
9
+ expect ( session . toJSON ( ) ) . toEqual (
10
+ expect . objectContaining ( { attrs : { release : JSON . stringify ( { name : 'whatever' } ) } } ) ,
11
+ ) ;
12
+ } ) ;
13
+ } ) ;
You can’t perform that action at this time.
0 commit comments