@@ -93,6 +93,162 @@ describe('converter utils', () => {
9393 } ) ;
9494 } ) ;
9595
96+ it ( 'should handle nested objects in vars using dot notation' , ( ) => {
97+ const event : SentryEvent = {
98+ exception : {
99+ values : [ {
100+ stacktrace : {
101+ frames : [ {
102+ filename : 'test.js' ,
103+ lineno : 10 ,
104+ vars : {
105+ params : {
106+ foo : 1 ,
107+ bar : 2 ,
108+ second : {
109+ glass : 3 ,
110+ } ,
111+ } ,
112+ } ,
113+ } ] ,
114+ } ,
115+ } ] ,
116+ } ,
117+ } ;
118+
119+ const backtrace = composeBacktrace ( event ) ;
120+
121+ expect ( backtrace ?. [ 0 ] . arguments ) . toEqual ( [
122+ 'params.foo=1' ,
123+ 'params.bar=2' ,
124+ 'params.second.glass=3' ,
125+ ] ) ;
126+ } ) ;
127+
128+ it ( 'should handle arrays in vars using dot notation with indices' , ( ) => {
129+ const event : SentryEvent = {
130+ exception : {
131+ values : [ {
132+ stacktrace : {
133+ frames : [ {
134+ filename : 'test.js' ,
135+ lineno : 10 ,
136+ vars : {
137+ items : [ 'first' , 'second' , 'third' ] ,
138+ } ,
139+ } ] ,
140+ } ,
141+ } ] ,
142+ } ,
143+ } ;
144+
145+ const backtrace = composeBacktrace ( event ) ;
146+
147+ expect ( backtrace ?. [ 0 ] . arguments ) . toEqual ( [
148+ 'items.0=first' ,
149+ 'items.1=second' ,
150+ 'items.2=third' ,
151+ ] ) ;
152+ } ) ;
153+
154+ it ( 'should handle mixed nested objects and arrays in vars' , ( ) => {
155+ const event : SentryEvent = {
156+ exception : {
157+ values : [ {
158+ stacktrace : {
159+ frames : [ {
160+ filename : 'test.js' ,
161+ lineno : 10 ,
162+ vars : {
163+ config : {
164+ users : [
165+ {
166+ name : 'Alice' ,
167+ age : 30 ,
168+ } ,
169+ {
170+ name : 'Bob' ,
171+ age : 25 ,
172+ } ,
173+ ] ,
174+ settings : {
175+ enabled : true ,
176+ } ,
177+ } ,
178+ } ,
179+ } ] ,
180+ } ,
181+ } ] ,
182+ } ,
183+ } ;
184+
185+ const backtrace = composeBacktrace ( event ) ;
186+
187+ expect ( backtrace ?. [ 0 ] . arguments ) . toEqual ( [
188+ 'config.users.0.name=Alice' ,
189+ 'config.users.0.age=30' ,
190+ 'config.users.1.name=Bob' ,
191+ 'config.users.1.age=25' ,
192+ 'config.settings.enabled=true' ,
193+ ] ) ;
194+ } ) ;
195+
196+ it ( 'should handle null and undefined values in vars' , ( ) => {
197+ const event : SentryEvent = {
198+ exception : {
199+ values : [ {
200+ stacktrace : {
201+ frames : [ {
202+ filename : 'test.js' ,
203+ lineno : 10 ,
204+ vars : {
205+ nullValue : null ,
206+ undefinedValue : undefined ,
207+ normalValue : 'test' ,
208+ } ,
209+ } ] ,
210+ } ,
211+ } ] ,
212+ } ,
213+ } ;
214+
215+ const backtrace = composeBacktrace ( event ) ;
216+
217+ expect ( backtrace ?. [ 0 ] . arguments ) . toEqual ( [
218+ 'nullValue=null' ,
219+ 'undefinedValue=undefined' ,
220+ 'normalValue=test' ,
221+ ] ) ;
222+ } ) ;
223+
224+ it ( 'should handle empty objects and arrays in vars' , ( ) => {
225+ const event : SentryEvent = {
226+ exception : {
227+ values : [ {
228+ stacktrace : {
229+ frames : [ {
230+ filename : 'test.js' ,
231+ lineno : 10 ,
232+ vars : {
233+ emptyObject : { } ,
234+ emptyArray : [ ] ,
235+ normalValue : 'test' ,
236+ } ,
237+ } ] ,
238+ } ,
239+ } ] ,
240+ } ,
241+ } ;
242+
243+ const backtrace = composeBacktrace ( event ) ;
244+
245+ expect ( backtrace ?. [ 0 ] . arguments ) . toEqual ( [
246+ 'emptyObject={}' ,
247+ 'emptyArray=[]' ,
248+ 'normalValue=test' ,
249+ ] ) ;
250+ } ) ;
251+
96252 it ( 'should reverse frames' , ( ) => {
97253 const event : SentryEvent = {
98254 exception : {
0 commit comments