|
@@ -15,6 +15,7 @@ jest.mock('sentry/utils/routeAnalytics/useRouteAnalyticsParams');
|
|
|
describe('TraceTimeline', () => {
|
|
|
const organization = OrganizationFixture({features: ['issues-trace-timeline']});
|
|
|
const event = EventFixture({
|
|
|
+ dateCreated: '2024-01-24T09:09:03+00:00',
|
|
|
contexts: {
|
|
|
trace: {
|
|
|
trace_id: '123',
|
|
@@ -23,6 +24,7 @@ describe('TraceTimeline', () => {
|
|
|
});
|
|
|
const project = ProjectFixture();
|
|
|
|
|
|
+ const emptyBody: TraceEventResponse = {data: [], meta: {fields: {}, units: {}}};
|
|
|
const issuePlatformBody: TraceEventResponse = {
|
|
|
data: [
|
|
|
{
|
|
@@ -32,7 +34,6 @@ describe('TraceTimeline', () => {
|
|
|
'project.name': project.name,
|
|
|
title: 'Slow DB Query',
|
|
|
id: 'abc',
|
|
|
- issue: 'SENTRY-ABC1',
|
|
|
transaction: '/api/slow/',
|
|
|
},
|
|
|
],
|
|
@@ -47,7 +48,6 @@ describe('TraceTimeline', () => {
|
|
|
'project.name': project.name,
|
|
|
title: 'AttributeError: Something Failed',
|
|
|
id: event.id,
|
|
|
- issue: 'SENTRY-2EYS',
|
|
|
transaction: 'important.task',
|
|
|
'event.type': 'error',
|
|
|
'stack.function': ['important.task', 'task.run'],
|
|
@@ -85,10 +85,7 @@ describe('TraceTimeline', () => {
|
|
|
it('displays nothing if the only event is the current event', async () => {
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: `/organizations/${organization.slug}/events/`,
|
|
|
- body: {
|
|
|
- data: [],
|
|
|
- meta: {fields: {}, units: {}},
|
|
|
- },
|
|
|
+ body: emptyBody,
|
|
|
match: [MockApiClient.matchQuery({dataset: 'issuePlatform'})],
|
|
|
});
|
|
|
MockApiClient.addMockResponse({
|
|
@@ -106,18 +103,12 @@ describe('TraceTimeline', () => {
|
|
|
it('displays nothing if there are no events', async () => {
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: `/organizations/${organization.slug}/events/`,
|
|
|
- body: {
|
|
|
- data: [],
|
|
|
- meta: {fields: {}, units: {}},
|
|
|
- },
|
|
|
+ body: emptyBody,
|
|
|
match: [MockApiClient.matchQuery({dataset: 'issuePlatform'})],
|
|
|
});
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: `/organizations/${organization.slug}/events/`,
|
|
|
- body: {
|
|
|
- data: [],
|
|
|
- meta: {fields: {}, units: {}},
|
|
|
- },
|
|
|
+ body: emptyBody,
|
|
|
match: [MockApiClient.matchQuery({dataset: 'discover'})],
|
|
|
});
|
|
|
render(<TraceTimeline event={event} />, {organization});
|
|
@@ -135,14 +126,26 @@ describe('TraceTimeline', () => {
|
|
|
});
|
|
|
MockApiClient.addMockResponse({
|
|
|
url: `/organizations/${organization.slug}/events/`,
|
|
|
- body: {
|
|
|
- data: [],
|
|
|
- meta: {fields: {}, units: {}},
|
|
|
- },
|
|
|
+ body: emptyBody,
|
|
|
match: [MockApiClient.matchQuery({dataset: 'discover'})],
|
|
|
});
|
|
|
render(<TraceTimeline event={event} />, {organization});
|
|
|
// Checking for the presence of seconds
|
|
|
expect(await screen.findAllByText(/\d{1,2}:\d{2}:\d{2} (AM|PM)/)).toHaveLength(5);
|
|
|
});
|
|
|
+
|
|
|
+ it('adds the current event if not in the api response', async () => {
|
|
|
+ MockApiClient.addMockResponse({
|
|
|
+ url: `/organizations/${organization.slug}/events/`,
|
|
|
+ body: issuePlatformBody,
|
|
|
+ match: [MockApiClient.matchQuery({dataset: 'issuePlatform'})],
|
|
|
+ });
|
|
|
+ MockApiClient.addMockResponse({
|
|
|
+ url: `/organizations/${organization.slug}/events/`,
|
|
|
+ body: emptyBody,
|
|
|
+ match: [MockApiClient.matchQuery({dataset: 'discover'})],
|
|
|
+ });
|
|
|
+ render(<TraceTimeline event={event} />, {organization});
|
|
|
+ expect(await screen.findByLabelText('Current Event')).toBeInTheDocument();
|
|
|
+ });
|
|
|
});
|