11import { logger } from '@sentry/core' ;
2- import { _getSpanProcessorTimeout } from '../../src/sdk/initOtel' ;
2+ import { _clampSpanProcessorTimeout } from '../../src/sdk/initOtel' ;
33
4- describe ( '_getSpanProcessorTimeout ' , ( ) => {
4+ describe ( '_clampSpanProcessorTimeout ' , ( ) => {
55 beforeEach ( ( ) => {
66 jest . clearAllMocks ( ) ;
77 } ) ;
88
99 it ( 'works with undefined' , ( ) => {
1010 const loggerWarnSpy = jest . spyOn ( logger , 'warn' ) . mockImplementation ( ( ) => { } ) ;
11- const timeout = _getSpanProcessorTimeout ( undefined ) ;
11+ const timeout = _clampSpanProcessorTimeout ( undefined ) ;
1212 expect ( timeout ) . toBe ( undefined ) ;
1313 expect ( loggerWarnSpy ) . not . toHaveBeenCalled ( ) ;
1414 } ) ;
1515
1616 it ( 'works with positive number' , ( ) => {
1717 const loggerWarnSpy = jest . spyOn ( logger , 'warn' ) . mockImplementation ( ( ) => { } ) ;
18- const timeout = _getSpanProcessorTimeout ( 10 ) ;
18+ const timeout = _clampSpanProcessorTimeout ( 10 ) ;
1919 expect ( timeout ) . toBe ( 10 ) ;
2020 expect ( loggerWarnSpy ) . not . toHaveBeenCalled ( ) ;
2121 } ) ;
2222
2323 it ( 'works with 0' , ( ) => {
2424 const loggerWarnSpy = jest . spyOn ( logger , 'warn' ) . mockImplementation ( ( ) => { } ) ;
25- const timeout = _getSpanProcessorTimeout ( 0 ) ;
25+ const timeout = _clampSpanProcessorTimeout ( 0 ) ;
2626 expect ( timeout ) . toBe ( undefined ) ;
2727 expect ( loggerWarnSpy ) . toHaveBeenCalledTimes ( 1 ) ;
2828 expect ( loggerWarnSpy ) . toHaveBeenCalledWith (
@@ -32,7 +32,7 @@ describe('_getSpanProcessorTimeout', () => {
3232
3333 it ( 'works with negative number' , ( ) => {
3434 const loggerWarnSpy = jest . spyOn ( logger , 'warn' ) . mockImplementation ( ( ) => { } ) ;
35- const timeout = _getSpanProcessorTimeout ( - 10 ) ;
35+ const timeout = _clampSpanProcessorTimeout ( - 10 ) ;
3636 expect ( timeout ) . toBe ( undefined ) ;
3737 expect ( loggerWarnSpy ) . toHaveBeenCalledTimes ( 1 ) ;
3838 expect ( loggerWarnSpy ) . toHaveBeenCalledWith (
@@ -42,7 +42,7 @@ describe('_getSpanProcessorTimeout', () => {
4242
4343 it ( 'works with -Infinity' , ( ) => {
4444 const loggerWarnSpy = jest . spyOn ( logger , 'warn' ) . mockImplementation ( ( ) => { } ) ;
45- const timeout = _getSpanProcessorTimeout ( - Infinity ) ;
45+ const timeout = _clampSpanProcessorTimeout ( - Infinity ) ;
4646 expect ( timeout ) . toBe ( undefined ) ;
4747 expect ( loggerWarnSpy ) . toHaveBeenCalledTimes ( 1 ) ;
4848 expect ( loggerWarnSpy ) . toHaveBeenCalledWith (
@@ -52,23 +52,23 @@ describe('_getSpanProcessorTimeout', () => {
5252
5353 it ( 'works with Infinity' , ( ) => {
5454 const loggerWarnSpy = jest . spyOn ( logger , 'warn' ) . mockImplementation ( ( ) => { } ) ;
55- const timeout = _getSpanProcessorTimeout ( Infinity ) ;
55+ const timeout = _clampSpanProcessorTimeout ( Infinity ) ;
5656 expect ( timeout ) . toBe ( 1_000_000 ) ;
5757 expect ( loggerWarnSpy ) . toHaveBeenCalledTimes ( 1 ) ;
5858 expect ( loggerWarnSpy ) . toHaveBeenCalledWith ( '`maxSpanWaitDuration` is too high, using the maximum value of 1000000' ) ;
5959 } ) ;
6060
6161 it ( 'works with large number' , ( ) => {
6262 const loggerWarnSpy = jest . spyOn ( logger , 'warn' ) . mockImplementation ( ( ) => { } ) ;
63- const timeout = _getSpanProcessorTimeout ( 1_000_000_000 ) ;
63+ const timeout = _clampSpanProcessorTimeout ( 1_000_000_000 ) ;
6464 expect ( timeout ) . toBe ( 1_000_000 ) ;
6565 expect ( loggerWarnSpy ) . toHaveBeenCalledTimes ( 1 ) ;
6666 expect ( loggerWarnSpy ) . toHaveBeenCalledWith ( '`maxSpanWaitDuration` is too high, using the maximum value of 1000000' ) ;
6767 } ) ;
6868
6969 it ( 'works with NaN' , ( ) => {
7070 const loggerWarnSpy = jest . spyOn ( logger , 'warn' ) . mockImplementation ( ( ) => { } ) ;
71- const timeout = _getSpanProcessorTimeout ( NaN ) ;
71+ const timeout = _clampSpanProcessorTimeout ( NaN ) ;
7272 expect ( timeout ) . toBe ( undefined ) ;
7373 expect ( loggerWarnSpy ) . toHaveBeenCalledTimes ( 1 ) ;
7474 expect ( loggerWarnSpy ) . toHaveBeenCalledWith (
0 commit comments