@@ -50,18 +50,16 @@ describe('shouldRemoveNumberKey', () => {
5050} ) ;
5151
5252function addAttributeMock (
53- attributeType : string ,
54- body : Array < { key : string ; name : string ; secondaryAliases ?: string [ ] } >
53+ body : Array < {
54+ attributeType : 'string' | 'number' | 'boolean' ;
55+ key : string ;
56+ name : string ;
57+ secondaryAliases ?: string [ ] ;
58+ } >
5559) {
5660 MockApiClient . addMockResponse ( {
5761 url : '/organizations/org-slug/trace-items/attributes/' ,
5862 body,
59- match : [
60- ( _url , options ) => {
61- const query = options ?. query || { } ;
62- return query . attributeType === attributeType ;
63- } ,
64- ] ,
6563 } ) ;
6664}
6765
@@ -87,12 +85,11 @@ describe('useTraceItemAttributes number filtering', () => {
8785 it ( 'filters out number attributes that overlap with boolean attributes' , async ( ) => {
8886 const organization = OrganizationFixture ( ) ;
8987
90- addAttributeMock ( 'number' , [
91- { key : 'is_transaction' , name : 'is_transaction' } ,
92- { key : 'custom_metric' , name : 'custom_metric' } ,
88+ addAttributeMock ( [
89+ { attributeType : 'number' , key : 'is_transaction' , name : 'is_transaction' } ,
90+ { attributeType : 'number' , key : 'custom_metric' , name : 'custom_metric' } ,
91+ { attributeType : 'boolean' , key : 'is_transaction' , name : 'is_transaction' } ,
9392 ] ) ;
94- addAttributeMock ( 'string' , [ ] ) ;
95- addAttributeMock ( 'boolean' , [ { key : 'is_transaction' , name : 'is_transaction' } ] ) ;
9693
9794 const { result} = renderHookWithProviders (
9895 ( ) =>
@@ -117,12 +114,10 @@ describe('useTraceItemAttributes number filtering', () => {
117114 it ( 'filters number attributes that overlap with default boolean attributes' , async ( ) => {
118115 const organization = OrganizationFixture ( ) ;
119116
120- addAttributeMock ( 'number' , [
121- { key : 'is_transaction' , name : 'is_transaction' } ,
122- { key : 'custom_metric' , name : 'custom_metric' } ,
117+ addAttributeMock ( [
118+ { attributeType : 'number' , key : 'is_transaction' , name : 'is_transaction' } ,
119+ { attributeType : 'number' , key : 'custom_metric' , name : 'custom_metric' } ,
123120 ] ) ;
124- addAttributeMock ( 'string' , [ ] ) ;
125- addAttributeMock ( 'boolean' , [ ] ) ;
126121
127122 const { result} = renderHookWithProviders (
128123 ( ) =>
@@ -147,13 +142,18 @@ describe('useTraceItemAttributes number filtering', () => {
147142 it ( 'filters tags[key,number] format when boolean version exists' , async ( ) => {
148143 const organization = OrganizationFixture ( ) ;
149144
150- addAttributeMock ( 'number' , [
151- { key : 'tags[is_transaction,number]' , name : 'tags[is_transaction,number]' } ,
152- { key : 'custom_metric' , name : 'custom_metric' } ,
153- ] ) ;
154- addAttributeMock ( 'string' , [ ] ) ;
155- addAttributeMock ( 'boolean' , [
156- { key : 'tags[is_transaction,boolean]' , name : 'tags[is_transaction,boolean]' } ,
145+ addAttributeMock ( [
146+ {
147+ attributeType : 'number' ,
148+ key : 'tags[is_transaction,number]' ,
149+ name : 'tags[is_transaction,number]' ,
150+ } ,
151+ { attributeType : 'number' , key : 'custom_metric' , name : 'custom_metric' } ,
152+ {
153+ attributeType : 'boolean' ,
154+ key : 'tags[is_transaction,boolean]' ,
155+ name : 'tags[is_transaction,boolean]' ,
156+ } ,
157157 ] ) ;
158158
159159 const { result} = renderHookWithProviders (
@@ -179,16 +179,18 @@ describe('useTraceItemAttributes number filtering', () => {
179179 it ( 'filters overlapping number secondary aliases when boolean version exists' , async ( ) => {
180180 const organization = OrganizationFixture ( ) ;
181181
182- addAttributeMock ( 'number' , [
182+ addAttributeMock ( [
183183 {
184+ attributeType : 'number' ,
184185 key : 'custom_metric' ,
185186 name : 'custom_metric' ,
186187 secondaryAliases : [ 'tags[is_transaction,number]' , 'tags[custom_metric,number]' ] ,
187188 } ,
188- ] ) ;
189- addAttributeMock ( 'string' , [ ] ) ;
190- addAttributeMock ( 'boolean' , [
191- { key : 'tags[is_transaction,boolean]' , name : 'tags[is_transaction,boolean]' } ,
189+ {
190+ attributeType : 'boolean' ,
191+ key : 'tags[is_transaction,boolean]' ,
192+ name : 'tags[is_transaction,boolean]' ,
193+ } ,
192194 ] ) ;
193195
194196 const { result} = renderHookWithProviders (
@@ -214,12 +216,11 @@ describe('useTraceItemAttributes number filtering', () => {
214216 it ( 'preserves non-overlapping number attributes' , async ( ) => {
215217 const organization = OrganizationFixture ( ) ;
216218
217- addAttributeMock ( 'number' , [
218- { key : 'custom_metric' , name : 'custom_metric' } ,
219- { key : 'another_metric' , name : 'another_metric' } ,
219+ addAttributeMock ( [
220+ { attributeType : 'number' , key : 'custom_metric' , name : 'custom_metric' } ,
221+ { attributeType : 'number' , key : 'another_metric' , name : 'another_metric' } ,
222+ { attributeType : 'boolean' , key : 'is_transaction' , name : 'is_transaction' } ,
220223 ] ) ;
221- addAttributeMock ( 'string' , [ ] ) ;
222- addAttributeMock ( 'boolean' , [ { key : 'is_transaction' , name : 'is_transaction' } ] ) ;
223224
224225 const { result} = renderHookWithProviders (
225226 ( ) =>
0 commit comments