mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-10-30 14:49:14 +00:00
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import {GroupFixture} from 'sentry-fixture/group';
|
|
import {OrganizationFixture} from 'sentry-fixture/organization';
|
|
import {TeamFixture} from 'sentry-fixture/team';
|
|
|
|
import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
import TeamIssuesAge from 'sentry/views/organizationStats/teamInsights/teamIssuesAge';
|
|
|
|
describe('TeamIssuesAge', () => {
|
|
it('should render graph with table of oldest issues', async () => {
|
|
const team = TeamFixture();
|
|
const organization = OrganizationFixture();
|
|
const timeToResolutionApi = MockApiClient.addMockResponse({
|
|
url: `/teams/${organization.slug}/${team.slug}/unresolved-issue-age/`,
|
|
body: {
|
|
'< 1 hour': 1,
|
|
'< 4 hour': 5,
|
|
'< 12 hour': 20,
|
|
'< 1 day': 80,
|
|
'< 1 week': 30,
|
|
'< 4 week': 100,
|
|
'< 24 week': 50,
|
|
'< 1 year': 100,
|
|
'> 1 year': 10,
|
|
},
|
|
});
|
|
const issuesApi = MockApiClient.addMockResponse({
|
|
url: `/teams/${organization.slug}/${team.slug}/issues/old/`,
|
|
body: [GroupFixture()],
|
|
});
|
|
render(<TeamIssuesAge organization={organization} teamSlug={team.slug} />);
|
|
|
|
// Title
|
|
expect(await screen.findByText('RequestError')).toBeInTheDocument();
|
|
// Event count
|
|
expect(screen.getByText('327k')).toBeInTheDocument();
|
|
// User count
|
|
expect(screen.getByText('35k')).toBeInTheDocument();
|
|
expect(timeToResolutionApi).toHaveBeenCalledTimes(1);
|
|
expect(issuesApi).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|