Skip to content

Commit 5a795d6

Browse files
committed
update tests
1 parent 6220328 commit 5a795d6

File tree

2 files changed

+51
-38
lines changed

2 files changed

+51
-38
lines changed

static/app/views/insights/database/views/databaseSpanSummaryPage.spec.tsx

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ describe('DatabaseSpanSummaryPage', function () {
166166
},
167167
});
168168

169+
MockApiClient.addMockResponse({
170+
url: `/projects/org-slug//releases/1.0.0/`,
171+
method: 'GET',
172+
body: [],
173+
});
174+
169175
const issuesRequestMock = MockApiClient.addMockResponse({
170176
url: `/organizations/${organization.slug}/issues/`,
171177
method: 'GET',
@@ -224,7 +230,6 @@ describe('DatabaseSpanSummaryPage', function () {
224230
environment: [],
225231
field: [
226232
'project_id',
227-
'transaction.id',
228233
'span.description',
229234
'db.system',
230235
'code.filepath',
@@ -327,7 +332,7 @@ describe('DatabaseSpanSummaryPage', function () {
327332
})
328333
);
329334

330-
expect(spanDescriptionRequestMock).toHaveBeenCalledTimes(1);
335+
expect(spanDescriptionRequestMock).toHaveBeenCalledTimes(2);
331336
expect(eventsRequestMock).toHaveBeenCalledTimes(1);
332337
expect(eventsStatsRequestMock).toHaveBeenCalledTimes(2);
333338
expect(transactionListMock).toHaveBeenCalledTimes(1);
@@ -351,26 +356,6 @@ describe('DatabaseSpanSummaryPage', function () {
351356
})
352357
);
353358

354-
// Span details for query source. This runs after the indexed span has loaded
355-
expect(eventsRequestMock).toHaveBeenNthCalledWith(
356-
2,
357-
`/organizations/${organization.slug}/events/`,
358-
expect.objectContaining({
359-
method: 'GET',
360-
query: {
361-
dataset: 'spansIndexed',
362-
environment: [],
363-
field: ['timestamp', 'transaction.id', 'project', 'span_id', 'span.self_time'],
364-
per_page: 1,
365-
project: [],
366-
query: 'span.group:1756baf8fd19c116',
367-
sort: '-span.self_time',
368-
referrer: 'api.starfish.full-span-from-trace',
369-
statsPeriod: '10d',
370-
},
371-
})
372-
);
373-
374359
expect(screen.getByRole('table', {name: 'Transactions'})).toBeInTheDocument();
375360

376361
expect(screen.getByRole('columnheader', {name: 'Found In'})).toBeInTheDocument();

static/app/views/insights/queues/components/messageSpanSamplesPanel.spec.tsx

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('messageSpanSamplesPanel', () => {
1616
let eventsRequestMock: jest.Mock;
1717
let eventsStatsRequestMock: jest.Mock;
1818
let samplesRequestMock: jest.Mock;
19-
let spanFieldTagsMock: jest.Mock;
19+
let traceItemAttributesMock: jest.Mock;
2020

2121
jest.mocked(usePageFilters).mockReturnValue(
2222
PageFilterStateFixture({
@@ -124,8 +124,8 @@ describe('messageSpanSamplesPanel', () => {
124124
},
125125
});
126126

127-
spanFieldTagsMock = MockApiClient.addMockResponse({
128-
url: `/organizations/${organization.slug}/spans/fields/`,
127+
traceItemAttributesMock = MockApiClient.addMockResponse({
128+
url: `/organizations/${organization.slug}/trace-items/attributes/`,
129129
method: 'GET',
130130
body: [
131131
{
@@ -139,11 +139,6 @@ describe('messageSpanSamplesPanel', () => {
139139
],
140140
});
141141

142-
MockApiClient.addMockResponse({
143-
url: '/organizations/org-slug/trace-items/attributes/',
144-
body: [],
145-
});
146-
147142
MockApiClient.addMockResponse({
148143
url: `/organizations/${organization.slug}/recent-searches/`,
149144
body: [],
@@ -230,15 +225,31 @@ describe('messageSpanSamplesPanel', () => {
230225
}),
231226
})
232227
);
233-
expect(spanFieldTagsMock).toHaveBeenNthCalledWith(
228+
expect(traceItemAttributesMock).toHaveBeenNthCalledWith(
234229
1,
235-
`/organizations/${organization.slug}/spans/fields/`,
230+
`/organizations/${organization.slug}/trace-items/attributes/`,
236231
expect.objectContaining({
237232
method: 'GET',
238233
query: {
234+
attributeType: 'number',
235+
itemType: 'spans',
239236
project: [],
240-
environment: [],
241-
statsPeriod: '1h',
237+
statsPeriod: '10d',
238+
substringMatch: undefined,
239+
},
240+
})
241+
);
242+
expect(traceItemAttributesMock).toHaveBeenNthCalledWith(
243+
2,
244+
`/organizations/${organization.slug}/trace-items/attributes/`,
245+
expect.objectContaining({
246+
method: 'GET',
247+
query: {
248+
attributeType: 'string',
249+
itemType: 'spans',
250+
project: [],
251+
statsPeriod: '10d',
252+
substringMatch: undefined,
242253
},
243254
})
244255
);
@@ -326,14 +337,31 @@ describe('messageSpanSamplesPanel', () => {
326337
}),
327338
})
328339
);
329-
expect(spanFieldTagsMock).toHaveBeenCalledWith(
330-
`/organizations/${organization.slug}/spans/fields/`,
340+
expect(traceItemAttributesMock).toHaveBeenNthCalledWith(
341+
1,
342+
`/organizations/${organization.slug}/trace-items/attributes/`,
331343
expect.objectContaining({
332344
method: 'GET',
333345
query: {
346+
attributeType: 'number',
347+
itemType: 'spans',
334348
project: [],
335-
environment: [],
336-
statsPeriod: '1h',
349+
statsPeriod: '10d',
350+
substringMatch: undefined,
351+
},
352+
})
353+
);
354+
expect(traceItemAttributesMock).toHaveBeenNthCalledWith(
355+
2,
356+
`/organizations/${organization.slug}/trace-items/attributes/`,
357+
expect.objectContaining({
358+
method: 'GET',
359+
query: {
360+
attributeType: 'string',
361+
itemType: 'spans',
362+
project: [],
363+
statsPeriod: '10d',
364+
substringMatch: undefined,
337365
},
338366
})
339367
);

0 commit comments

Comments
 (0)