@@ -23,36 +23,23 @@ afterEach(() => {
2323} ) ;
2424
2525describe ( 'createLogContainerEnvelopeItem' , ( ) => {
26- it ( 'creates an envelope item with legacy shape when span streaming is disabled' , ( ) => {
27- const mockLog : SerializedLog = {
28- timestamp : 1713859200 ,
29- level : 'error' ,
30- body : 'Test error message' ,
31- } ;
32-
33- const result = createLogContainerEnvelopeItem ( [ mockLog , mockLog ] ) ;
34-
35- expect ( result ) . toHaveLength ( 2 ) ;
36- expect ( result [ 0 ] ) . toEqual ( { type : 'log' , item_count : 2 , content_type : 'application/vnd.sentry.items.log+json' } ) ;
37- expect ( result [ 1 ] ) . toEqual ( { items : [ mockLog , mockLog ] } ) ;
38- } ) ;
39-
40- it ( 'emits version: 2 without ingest_settings when span streaming is enabled but not in browser' , ( ) => {
26+ it ( 'emits version: 2 without ingest_settings when not in browser' , ( ) => {
4127 const mockLog : SerializedLog = {
4228 timestamp : 1713859200 ,
4329 level : 'info' ,
4430 body : 'Test log message' ,
4531 } ;
4632
47- const result = createLogContainerEnvelopeItem ( [ mockLog ] , true , true ) ;
33+ const result = createLogContainerEnvelopeItem ( [ mockLog ] , true ) ;
4834
35+ expect ( result [ 0 ] ) . toEqual ( { type : 'log' , item_count : 1 , content_type : 'application/vnd.sentry.items.log+json' } ) ;
4936 expect ( result [ 1 ] ) . toEqual ( {
5037 version : 2 ,
5138 items : [ mockLog ] ,
5239 } ) ;
5340 } ) ;
5441
55- it ( "includes ingest_settings with 'auto' values when span streaming is enabled, in browser, and inferUserData is true" , ( ) => {
42+ it ( "includes ingest_settings with 'auto' values when in browser and inferUserData is true" , ( ) => {
5643 vi . mocked ( isBrowser ) . mockReturnValue ( true ) ;
5744
5845 const mockLog : SerializedLog = {
@@ -61,7 +48,7 @@ describe('createLogContainerEnvelopeItem', () => {
6148 body : 'Test log message' ,
6249 } ;
6350
64- const result = createLogContainerEnvelopeItem ( [ mockLog ] , true , true ) ;
51+ const result = createLogContainerEnvelopeItem ( [ mockLog ] , true ) ;
6552
6653 expect ( result [ 1 ] ) . toEqual ( {
6754 version : 2 ,
@@ -70,7 +57,7 @@ describe('createLogContainerEnvelopeItem', () => {
7057 } ) ;
7158 } ) ;
7259
73- it ( "includes ingest_settings with 'never' values when span streaming is enabled, in browser, and inferUserData is false" , ( ) => {
60+ it ( "includes ingest_settings with 'never' values when in browser and inferUserData is false" , ( ) => {
7461 vi . mocked ( isBrowser ) . mockReturnValue ( true ) ;
7562
7663 const mockLog : SerializedLog = {
@@ -79,30 +66,14 @@ describe('createLogContainerEnvelopeItem', () => {
7966 body : 'Test log message' ,
8067 } ;
8168
82- const result = createLogContainerEnvelopeItem ( [ mockLog ] , true , false ) ;
69+ const result = createLogContainerEnvelopeItem ( [ mockLog ] , false ) ;
8370
8471 expect ( result [ 1 ] ) . toEqual ( {
8572 version : 2 ,
8673 ingest_settings : { infer_ip : 'never' , infer_user_agent : 'never' } ,
8774 items : [ mockLog ] ,
8875 } ) ;
8976 } ) ;
90-
91- it ( 'omits version and ingest_settings when span streaming is disabled even if in browser' , ( ) => {
92- vi . mocked ( isBrowser ) . mockReturnValue ( true ) ;
93-
94- const mockLog : SerializedLog = {
95- timestamp : 1713859200 ,
96- level : 'info' ,
97- body : 'Test log message' ,
98- } ;
99-
100- const result = createLogContainerEnvelopeItem ( [ mockLog ] , false , true ) ;
101-
102- expect ( result [ 1 ] ) . toEqual ( {
103- items : [ mockLog ] ,
104- } ) ;
105- } ) ;
10677} ) ;
10778
10879describe ( 'createLogEnvelope' , ( ) => {
@@ -208,7 +179,7 @@ describe('createLogEnvelope', () => {
208179 expect . arrayContaining ( [
209180 expect . arrayContaining ( [
210181 { type : 'log' , item_count : 2 , content_type : 'application/vnd.sentry.items.log+json' } ,
211- { items : mockLogs } ,
182+ { version : 2 , items : mockLogs } ,
212183 ] ) ,
213184 ] ) ,
214185 ) ;
0 commit comments