1
- import * as matchSpan from './doesEntryMatchDefinition'
2
- import { doesEntryMatchDefinition } from './doesEntryMatchDefinition'
1
+ import * as matchSpan from './matchSpan'
3
2
import type { SpanAnnotation } from './spanAnnotationTypes'
4
3
import type { ComponentRenderSpan , SpanBase } from './spanTypes'
5
4
import type { ScopeBase } from './types'
@@ -66,9 +65,7 @@ describe('doesEntryMatchDefinition', () => {
66
65
span : mockEntryBase ,
67
66
annotation : mockAnnotation ,
68
67
}
69
- expect (
70
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
71
- ) . toBe ( true )
68
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
72
69
} )
73
70
74
71
it ( 'should return true for function matchers for name' , ( ) => {
@@ -77,9 +74,7 @@ describe('doesEntryMatchDefinition', () => {
77
74
span : mockEntryBase ,
78
75
annotation : mockAnnotation ,
79
76
}
80
- expect (
81
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
82
- ) . toBe ( true )
77
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
83
78
} )
84
79
85
80
it ( 'should return true for regex matchers for name' , ( ) => {
@@ -88,9 +83,7 @@ describe('doesEntryMatchDefinition', () => {
88
83
span : mockEntryBase ,
89
84
annotation : mockAnnotation ,
90
85
}
91
- expect (
92
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
93
- ) . toBe ( true )
86
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
94
87
} )
95
88
96
89
it ( 'should return false for a non-matching span based on name' , ( ) => {
@@ -99,9 +92,7 @@ describe('doesEntryMatchDefinition', () => {
99
92
span : mockEntryBase ,
100
93
annotation : mockAnnotation ,
101
94
}
102
- expect (
103
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
104
- ) . toBe ( false )
95
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( false )
105
96
} )
106
97
} )
107
98
@@ -112,9 +103,7 @@ describe('doesEntryMatchDefinition', () => {
112
103
span : mockPerformanceEntry ,
113
104
annotation : mockAnnotation ,
114
105
}
115
- expect (
116
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
117
- ) . toBe ( true )
106
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
118
107
} )
119
108
120
109
it ( 'should return false for a non-matching performanceEntryName' , ( ) => {
@@ -123,9 +112,7 @@ describe('doesEntryMatchDefinition', () => {
123
112
span : mockPerformanceEntry ,
124
113
annotation : mockAnnotation ,
125
114
}
126
- expect (
127
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
128
- ) . toBe ( false )
115
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( false )
129
116
} )
130
117
} )
131
118
@@ -137,9 +124,7 @@ describe('doesEntryMatchDefinition', () => {
137
124
span : mockEntryBase ,
138
125
annotation : mockAnnotation ,
139
126
}
140
- expect (
141
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
142
- ) . toBe ( true )
127
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
143
128
} )
144
129
145
130
it ( 'should return false for non-matching attributes' , ( ) => {
@@ -148,9 +133,7 @@ describe('doesEntryMatchDefinition', () => {
148
133
span : mockEntryBase ,
149
134
annotation : mockAnnotation ,
150
135
}
151
- expect (
152
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
153
- ) . toBe ( false )
136
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( false )
154
137
} )
155
138
} )
156
139
@@ -164,9 +147,7 @@ describe('doesEntryMatchDefinition', () => {
164
147
span : mockComponentEntry ,
165
148
annotation : mockAnnotation ,
166
149
}
167
- expect (
168
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
169
- ) . toBe ( true )
150
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
170
151
} )
171
152
172
153
it ( 'should return false for a non-matching ComponentRenderTraceEntry' , ( ) => {
@@ -178,9 +159,7 @@ describe('doesEntryMatchDefinition', () => {
178
159
span : mockComponentEntry ,
179
160
annotation : mockAnnotation ,
180
161
}
181
- expect (
182
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
183
- ) . toBe ( false )
162
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( false )
184
163
} )
185
164
} )
186
165
} )
@@ -192,9 +171,7 @@ describe('doesEntryMatchDefinition', () => {
192
171
span : mockEntryBase ,
193
172
annotation : mockAnnotation ,
194
173
}
195
- expect (
196
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
197
- ) . toBe ( true )
174
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
198
175
} )
199
176
200
177
it ( 'should return false when status does not match' , ( ) => {
@@ -203,9 +180,7 @@ describe('doesEntryMatchDefinition', () => {
203
180
span : mockEntryBase ,
204
181
annotation : mockAnnotation ,
205
182
}
206
- expect (
207
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
208
- ) . toBe ( false )
183
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( false )
209
184
} )
210
185
} )
211
186
@@ -219,10 +194,7 @@ describe('doesEntryMatchDefinition', () => {
219
194
span : mockEntryBase ,
220
195
annotation : mockAnnotation ,
221
196
}
222
- // Assuming occurrence logic is implemented in the function
223
- expect (
224
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
225
- ) . toBe ( true )
197
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
226
198
} )
227
199
228
200
it ( 'should return false for non-matching occurrence' , ( ) => {
@@ -234,10 +206,7 @@ describe('doesEntryMatchDefinition', () => {
234
206
span : mockEntryBase ,
235
207
annotation : mockAnnotation ,
236
208
}
237
- // Assuming occurrence logic is implemented in the function
238
- expect (
239
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
240
- ) . toBe ( false )
209
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( false )
241
210
} )
242
211
} )
243
212
@@ -248,9 +217,7 @@ describe('doesEntryMatchDefinition', () => {
248
217
span : mockEntryBase ,
249
218
annotation : mockAnnotation ,
250
219
}
251
- expect (
252
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
253
- ) . toBe ( true )
220
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
254
221
} )
255
222
256
223
it ( 'should return false for non-matching attributes' , ( ) => {
@@ -259,9 +226,7 @@ describe('doesEntryMatchDefinition', () => {
259
226
span : mockEntryBase ,
260
227
annotation : mockAnnotation ,
261
228
}
262
- expect (
263
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
264
- ) . toBe ( false )
229
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( false )
265
230
} )
266
231
} )
267
232
@@ -275,9 +240,7 @@ describe('doesEntryMatchDefinition', () => {
275
240
span : mockEntryBase ,
276
241
annotation : mockAnnotation ,
277
242
}
278
- expect (
279
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
280
- ) . toBe ( true )
243
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
281
244
} )
282
245
283
246
it ( 'should return false when scope does not match' , ( ) => {
@@ -293,9 +256,7 @@ describe('doesEntryMatchDefinition', () => {
293
256
span : mockEntryBase ,
294
257
annotation : mockAnnotation ,
295
258
}
296
- expect (
297
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , scope ) ,
298
- ) . toBe ( false )
259
+ expect ( matcher ( mockSpanAndAnnotation , scope ) ) . toBe ( false )
299
260
} )
300
261
} )
301
262
@@ -310,9 +271,7 @@ describe('doesEntryMatchDefinition', () => {
310
271
span : mockComponentEntry ,
311
272
annotation : mockAnnotation ,
312
273
}
313
- expect (
314
- doesEntryMatchDefinition ( mockSpanAndAnnotation , mockMatcher , mockScope ) ,
315
- ) . toBe ( true )
274
+ expect ( mockMatcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
316
275
} )
317
276
318
277
it ( 'should return false for non-matching isIdle' , ( ) => {
@@ -321,9 +280,7 @@ describe('doesEntryMatchDefinition', () => {
321
280
span : mockEntry ,
322
281
annotation : mockAnnotation ,
323
282
}
324
- expect (
325
- doesEntryMatchDefinition ( mockSpanAndAnnotation , mockMatcher , mockScope ) ,
326
- ) . toBe ( false )
283
+ expect ( mockMatcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( false )
327
284
} )
328
285
} )
329
286
@@ -341,9 +298,7 @@ describe('doesEntryMatchDefinition', () => {
341
298
span : mockPerformanceEntry ,
342
299
annotation : mockAnnotation ,
343
300
}
344
- expect (
345
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
346
- ) . toBe ( true )
301
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( true )
347
302
} )
348
303
349
304
it ( 'should return false when all conditions match but name' , ( ) => {
@@ -359,9 +314,7 @@ describe('doesEntryMatchDefinition', () => {
359
314
span : mockPerformanceEntry ,
360
315
annotation : mockAnnotation ,
361
316
}
362
- expect (
363
- doesEntryMatchDefinition ( mockSpanAndAnnotation , matcher , mockScope ) ,
364
- ) . toBe ( false )
317
+ expect ( matcher ( mockSpanAndAnnotation , mockScope ) ) . toBe ( false )
365
318
} )
366
319
} )
367
320
} )
0 commit comments