1
1
import { doesEntryMatchDefinition } from './doesEntryMatchDefinition'
2
- import type { ScopeBase , SpanAnnotation } from './types'
3
2
import type {
4
3
ComponentRenderSpan ,
5
4
Span ,
6
5
SpanBase ,
7
6
SpanMatcher ,
8
7
} from './spanTypes'
8
+ import type { ScopeBase , SpanAnnotation } from './types'
9
9
10
10
// Mock data for TraceEntryBase
11
11
interface TestScopeT extends ScopeBase {
@@ -62,7 +62,7 @@ describe('doesEntryMatchDefinition', () => {
62
62
it ( 'should return true for a matching entry based on name' , ( ) => {
63
63
const matcher : SpanMatcher < TestScopeT > = { name : 'testEntry' }
64
64
const mockEntryAndAnnotation = {
65
- entry : mockEntryBase ,
65
+ span : mockEntryBase ,
66
66
annotation : mockAnnotation ,
67
67
}
68
68
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -75,7 +75,7 @@ describe('doesEntryMatchDefinition', () => {
75
75
name : ( name : string ) => name . startsWith ( 'test' ) ,
76
76
}
77
77
const mockEntryAndAnnotation = {
78
- entry : mockEntryBase ,
78
+ span : mockEntryBase ,
79
79
annotation : mockAnnotation ,
80
80
}
81
81
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -88,20 +88,20 @@ describe('doesEntryMatchDefinition', () => {
88
88
name : / ^ t e s t / ,
89
89
}
90
90
const mockEntryAndAnnotation = {
91
- entry : mockEntryBase ,
91
+ span : mockEntryBase ,
92
92
annotation : mockAnnotation ,
93
93
}
94
94
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
95
95
true ,
96
96
)
97
97
} )
98
98
99
- it ( 'should return false for a non-matching entry based on name' , ( ) => {
99
+ it ( 'should return false for a non-matching span based on name' , ( ) => {
100
100
const matcher : SpanMatcher < TestScopeT > = {
101
101
name : 'nonMatchingEntry' ,
102
102
}
103
103
const mockEntryAndAnnotation = {
104
- entry : mockEntryBase ,
104
+ span : mockEntryBase ,
105
105
annotation : mockAnnotation ,
106
106
}
107
107
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -111,12 +111,12 @@ describe('doesEntryMatchDefinition', () => {
111
111
} )
112
112
113
113
describe ( 'performanceEntryName' , ( ) => {
114
- it ( 'should return true for a matching entry based on performanceEntryName' , ( ) => {
114
+ it ( 'should return true for a matching span based on performanceEntryName' , ( ) => {
115
115
const matcher : SpanMatcher < TestScopeT > = {
116
116
performanceEntryName : 'testEntry' ,
117
117
}
118
118
const mockEntryAndAnnotation = {
119
- entry : mockPerformanceEntry ,
119
+ span : mockPerformanceEntry ,
120
120
annotation : mockAnnotation ,
121
121
}
122
122
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -129,7 +129,7 @@ describe('doesEntryMatchDefinition', () => {
129
129
performanceEntryName : 'nonMatchingEntry' ,
130
130
}
131
131
const mockEntryAndAnnotation = {
132
- entry : mockPerformanceEntry ,
132
+ span : mockPerformanceEntry ,
133
133
annotation : mockAnnotation ,
134
134
}
135
135
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -143,7 +143,7 @@ describe('doesEntryMatchDefinition', () => {
143
143
it ( 'should return true for matching attributes' , ( ) => {
144
144
const matcher : SpanMatcher < TestScopeT > = { type : 'element' }
145
145
const mockEntryAndAnnotation = {
146
- entry : mockEntryBase ,
146
+ span : mockEntryBase ,
147
147
annotation : mockAnnotation ,
148
148
}
149
149
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -156,7 +156,7 @@ describe('doesEntryMatchDefinition', () => {
156
156
type : 'component-render' ,
157
157
}
158
158
const mockEntryAndAnnotation = {
159
- entry : mockEntryBase ,
159
+ span : mockEntryBase ,
160
160
annotation : mockAnnotation ,
161
161
}
162
162
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -172,7 +172,7 @@ describe('doesEntryMatchDefinition', () => {
172
172
name : 'testEntry' ,
173
173
}
174
174
const mockEntryAndAnnotation = {
175
- entry : mockComponentEntry ,
175
+ span : mockComponentEntry ,
176
176
annotation : mockAnnotation ,
177
177
}
178
178
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -186,7 +186,7 @@ describe('doesEntryMatchDefinition', () => {
186
186
name : 'nonMatchingEntry' ,
187
187
}
188
188
const mockEntryAndAnnotation = {
189
- entry : mockComponentEntry ,
189
+ span : mockComponentEntry ,
190
190
annotation : mockAnnotation ,
191
191
}
192
192
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -200,7 +200,7 @@ describe('doesEntryMatchDefinition', () => {
200
200
it ( 'should return true when status does match' , ( ) => {
201
201
const matcher : SpanMatcher < TestScopeT > = { status : 'ok' }
202
202
const mockEntryAndAnnotation = {
203
- entry : mockEntryBase ,
203
+ span : mockEntryBase ,
204
204
annotation : mockAnnotation ,
205
205
}
206
206
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -211,7 +211,7 @@ describe('doesEntryMatchDefinition', () => {
211
211
it ( 'should return false when status does not match' , ( ) => {
212
212
const matcher : SpanMatcher < TestScopeT > = { status : 'error' }
213
213
const mockEntryAndAnnotation = {
214
- entry : mockEntryBase ,
214
+ span : mockEntryBase ,
215
215
annotation : mockAnnotation ,
216
216
}
217
217
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -228,7 +228,7 @@ describe('doesEntryMatchDefinition', () => {
228
228
occurrence : 1 ,
229
229
}
230
230
const mockEntryAndAnnotation = {
231
- entry : mockEntryBase ,
231
+ span : mockEntryBase ,
232
232
annotation : mockAnnotation ,
233
233
}
234
234
// Assuming occurrence logic is implemented in the function
@@ -243,7 +243,7 @@ describe('doesEntryMatchDefinition', () => {
243
243
occurrence : 2 ,
244
244
}
245
245
const mockEntryAndAnnotation = {
246
- entry : mockEntryBase ,
246
+ span : mockEntryBase ,
247
247
annotation : mockAnnotation ,
248
248
}
249
249
// Assuming occurrence logic is implemented in the function
@@ -259,7 +259,7 @@ describe('doesEntryMatchDefinition', () => {
259
259
attributes : { attr1 : 'value1' } ,
260
260
}
261
261
const mockEntryAndAnnotation = {
262
- entry : mockEntryBase ,
262
+ span : mockEntryBase ,
263
263
annotation : mockAnnotation ,
264
264
}
265
265
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -272,7 +272,7 @@ describe('doesEntryMatchDefinition', () => {
272
272
attributes : { attr1 : 'wrongValue' } ,
273
273
}
274
274
const mockEntryAndAnnotation = {
275
- entry : mockEntryBase ,
275
+ span : mockEntryBase ,
276
276
annotation : mockAnnotation ,
277
277
}
278
278
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -290,7 +290,7 @@ describe('doesEntryMatchDefinition', () => {
290
290
} ,
291
291
}
292
292
const mockEntryAndAnnotation = {
293
- entry : mockEntryBase ,
293
+ span : mockEntryBase ,
294
294
annotation : mockAnnotation ,
295
295
}
296
296
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -307,7 +307,7 @@ describe('doesEntryMatchDefinition', () => {
307
307
} ,
308
308
}
309
309
const mockEntryAndAnnotation = {
310
- entry : mockEntryBase ,
310
+ span : mockEntryBase ,
311
311
annotation : mockAnnotation ,
312
312
}
313
313
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -324,7 +324,7 @@ describe('doesEntryMatchDefinition', () => {
324
324
325
325
it ( 'should return true for isIdle matching' , ( ) => {
326
326
const mockEntryAndAnnotation = {
327
- entry : mockComponentEntry ,
327
+ span : mockComponentEntry ,
328
328
annotation : mockAnnotation ,
329
329
}
330
330
expect (
@@ -335,7 +335,7 @@ describe('doesEntryMatchDefinition', () => {
335
335
it ( 'should return false for non-matching isIdle' , ( ) => {
336
336
const mockEntry = { ...mockComponentEntry , isIdle : false }
337
337
const mockEntryAndAnnotation = {
338
- entry : mockEntry ,
338
+ span : mockEntry ,
339
339
annotation : mockAnnotation ,
340
340
}
341
341
expect (
@@ -357,7 +357,7 @@ describe('doesEntryMatchDefinition', () => {
357
357
type : 'element' ,
358
358
}
359
359
const mockEntryAndAnnotation = {
360
- entry : mockPerformanceEntry ,
360
+ span : mockPerformanceEntry ,
361
361
annotation : mockAnnotation ,
362
362
}
363
363
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
@@ -377,7 +377,7 @@ describe('doesEntryMatchDefinition', () => {
377
377
type : 'element' ,
378
378
}
379
379
const mockEntryAndAnnotation = {
380
- entry : mockPerformanceEntry ,
380
+ span : mockPerformanceEntry ,
381
381
annotation : mockAnnotation ,
382
382
}
383
383
expect ( doesEntryMatchDefinition ( mockEntryAndAnnotation , matcher ) ) . toBe (
0 commit comments