File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -272,16 +272,12 @@ describe('Top level API', () => {
272272 } ) ;
273273
274274 it ( 'should generate and store a new session ID if none exists' , ( ) => {
275+ const storage : Record < string , string > = { } ;
275276 const sessionStorageMock = {
276- getItem : ( ) => null ,
277- setItem : ( _ : string , __ : string ) => { }
278- } ;
279- sessionStorageMock . setItem = (
280- key : string ,
281- value : string
282- ) => {
283- // @ts -ignore
284- sessionStorageMock [ key ] = value ;
277+ getItem : ( key : string ) => storage [ key ] || null ,
278+ setItem : ( key : string , value : string ) => {
279+ storage [ key ] = value ;
280+ }
285281 } ;
286282 const cryptoMock = {
287283 randomUUID : ( ) => 'new-session-id'
@@ -301,8 +297,7 @@ describe('Top level API', () => {
301297 expect ( emittedLogs . length ) . to . equal ( 1 ) ;
302298 const log = emittedLogs [ 0 ] ;
303299 expect ( log . attributes ! [ LOG_ENTRY_ATTRIBUTE_KEYS . SESSION_ID ] ) . to . equal ( 'new-session-id' ) ;
304- // @ts -ignore
305- expect ( sessionStorageMock [ TELEMETRY_SESSION_ID_KEY ] ) . to . equal (
300+ expect ( storage [ TELEMETRY_SESSION_ID_KEY ] ) . to . equal (
306301 'new-session-id'
307302 ) ;
308303 } ) ;
You can’t perform that action at this time.
0 commit comments