|
@@ -1,9 +1,8 @@
|
|
import {GroupFixture} from 'sentry-fixture/group';
|
|
import {GroupFixture} from 'sentry-fixture/group';
|
|
import {OrganizationFixture} from 'sentry-fixture/organization';
|
|
import {OrganizationFixture} from 'sentry-fixture/organization';
|
|
import {ProjectFixture} from 'sentry-fixture/project';
|
|
import {ProjectFixture} from 'sentry-fixture/project';
|
|
-import {RepositoryFixture} from 'sentry-fixture/repository';
|
|
|
|
|
|
|
|
-import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
|
|
|
|
|
|
+import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
|
|
import {GroupStatus} from 'sentry/types/group';
|
|
import {GroupStatus} from 'sentry/types/group';
|
|
import type {EventData} from 'sentry/utils/discover/eventView';
|
|
import type {EventData} from 'sentry/utils/discover/eventView';
|
|
@@ -36,30 +35,10 @@ const renderIssueContext = (dataRow: EventData = defaultRow) => {
|
|
describe('Quick Context Content Issue Column', function () {
|
|
describe('Quick Context Content Issue Column', function () {
|
|
beforeEach(() => {
|
|
beforeEach(() => {
|
|
MockApiClient.addMockResponse({
|
|
MockApiClient.addMockResponse({
|
|
- url: '/organizations/org-slug/users/',
|
|
|
|
- body: [],
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- MockApiClient.addMockResponse({
|
|
|
|
- url: '/projects/org-slug/cool-team/events/6b43e285de834ec5b5fe30d62d549b20/committers/',
|
|
|
|
- body: [],
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- MockApiClient.addMockResponse({
|
|
|
|
- url: '/issues/3512441874/events/oldest/',
|
|
|
|
- method: 'GET',
|
|
|
|
- body: [],
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- MockApiClient.addMockResponse({
|
|
|
|
- url: '/issues/3512441874/',
|
|
|
|
|
|
+ url: '/organizations/org-slug/issues/3512441874/',
|
|
method: 'GET',
|
|
method: 'GET',
|
|
body: mockedGroup,
|
|
body: mockedGroup,
|
|
});
|
|
});
|
|
- MockApiClient.addMockResponse({
|
|
|
|
- url: `/organizations/org-slug/projects/`,
|
|
|
|
- body: [ProjectFixture()],
|
|
|
|
- });
|
|
|
|
});
|
|
});
|
|
|
|
|
|
afterEach(function () {
|
|
afterEach(function () {
|
|
@@ -77,7 +56,7 @@ describe('Quick Context Content Issue Column', function () {
|
|
it('Renders resolved issue status context', async () => {
|
|
it('Renders resolved issue status context', async () => {
|
|
const group = {...mockedGroup, status: GroupStatus.RESOLVED};
|
|
const group = {...mockedGroup, status: GroupStatus.RESOLVED};
|
|
MockApiClient.addMockResponse({
|
|
MockApiClient.addMockResponse({
|
|
- url: '/issues/3512441874/',
|
|
|
|
|
|
+ url: '/organizations/org-slug/issues/3512441874/',
|
|
method: 'GET',
|
|
method: 'GET',
|
|
body: group,
|
|
body: group,
|
|
});
|
|
});
|
|
@@ -91,7 +70,7 @@ describe('Quick Context Content Issue Column', function () {
|
|
it('Renders unresolved issue status context', async () => {
|
|
it('Renders unresolved issue status context', async () => {
|
|
const group = {...mockedGroup, status: GroupStatus.UNRESOLVED};
|
|
const group = {...mockedGroup, status: GroupStatus.UNRESOLVED};
|
|
MockApiClient.addMockResponse({
|
|
MockApiClient.addMockResponse({
|
|
- url: '/issues/3512441874/',
|
|
|
|
|
|
+ url: '/organizations/org-slug/issues/3512441874/',
|
|
method: 'GET',
|
|
method: 'GET',
|
|
body: group,
|
|
body: group,
|
|
});
|
|
});
|
|
@@ -125,93 +104,4 @@ describe('Quick Context Content Issue Column', function () {
|
|
expect(await screen.findByText(/Title/i)).toBeInTheDocument();
|
|
expect(await screen.findByText(/Title/i)).toBeInTheDocument();
|
|
expect(screen.getByText(/typeError: error description/i)).toBeInTheDocument();
|
|
expect(screen.getByText(/typeError: error description/i)).toBeInTheDocument();
|
|
});
|
|
});
|
|
-
|
|
|
|
- describe('Suspect commits', () => {
|
|
|
|
- const maiseyCommitter = {
|
|
|
|
- author: {name: 'Maisey the Dog', id: '1231'},
|
|
|
|
- commits: [
|
|
|
|
- {
|
|
|
|
- message: 'feat(simulator): Add option for multiple squirrels (#1121)',
|
|
|
|
- id: 'ab2709293d0c9000829084ac7b1c9221fb18437c',
|
|
|
|
- dateCreated: '2012-09-08T04:15:12',
|
|
|
|
- repository: RepositoryFixture(),
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- };
|
|
|
|
- const charlieCommitter = {
|
|
|
|
- author: {name: 'Charlie Bear', id: '1121'},
|
|
|
|
- commits: [
|
|
|
|
- {
|
|
|
|
- message:
|
|
|
|
- 'ref(simulator): Split leaderboard calculations into separate functions (#1231)',
|
|
|
|
- id: 'fe29668b24cea6faad8afb8f6d9417f402ef9c18',
|
|
|
|
- dateCreated: '2012-04-15T09:09:12',
|
|
|
|
- repository: RepositoryFixture(),
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- beforeEach(() => {
|
|
|
|
- MockApiClient.addMockResponse({
|
|
|
|
- url: '/issues/3512441874/events/oldest/',
|
|
|
|
- method: 'GET',
|
|
|
|
- body: {
|
|
|
|
- eventID: '6b43e285de834ec5b5fe30d62d549b20',
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- afterEach(() => {
|
|
|
|
- MockApiClient.clearMockResponses();
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- it('Renders a single suspect commit', async () => {
|
|
|
|
- MockApiClient.addMockResponse({
|
|
|
|
- method: 'GET',
|
|
|
|
- url: '/projects/org-slug/cool-team/events/6b43e285de834ec5b5fe30d62d549b20/committers/',
|
|
|
|
- body: {
|
|
|
|
- committers: [maiseyCommitter],
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- renderIssueContext();
|
|
|
|
-
|
|
|
|
- // Make sure the title renders in the singular, since there's only one commit
|
|
|
|
- expect(await screen.findByText(/Suspect Commit/i)).toBeInTheDocument();
|
|
|
|
- expect(screen.queryByText(/Suspect Commits/i)).not.toBeInTheDocument();
|
|
|
|
-
|
|
|
|
- // Ensure all commit data is present
|
|
|
|
- expect(screen.getByText(/MD/i)).toBeInTheDocument();
|
|
|
|
- expect(screen.getByTestId('quick-context-commit-row')).toHaveTextContent(
|
|
|
|
- /View commit ab27092 by Maisey the Dog/
|
|
|
|
- );
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- it('Renders multiple suspect commits', async () => {
|
|
|
|
- MockApiClient.addMockResponse({
|
|
|
|
- method: 'GET',
|
|
|
|
- url: '/projects/org-slug/cool-team/events/6b43e285de834ec5b5fe30d62d549b20/committers/',
|
|
|
|
- body: {
|
|
|
|
- committers: [maiseyCommitter, charlieCommitter],
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- renderIssueContext();
|
|
|
|
-
|
|
|
|
- // Make sure the title renders in the plural
|
|
|
|
- expect(await screen.findByText(/Suspect Commits \(2\)/i)).toBeInTheDocument();
|
|
|
|
-
|
|
|
|
- // When there's more than one commit, any past the first start out hidden
|
|
|
|
- const expandButton = await screen.findByTestId('expand-commit-list');
|
|
|
|
- await userEvent.click(expandButton);
|
|
|
|
-
|
|
|
|
- // Check that they're both there
|
|
|
|
- expect(screen.getByText(/MD/i)).toBeInTheDocument();
|
|
|
|
- expect(screen.getByText(/CB/i)).toBeInTheDocument();
|
|
|
|
- expect(screen.getAllByTestId('quick-context-commit-row')[0]).toHaveTextContent(
|
|
|
|
- /View commit ab27092 by Maisey the Dog/
|
|
|
|
- );
|
|
|
|
- expect(screen.getAllByTestId('quick-context-commit-row')[1]).toHaveTextContent(
|
|
|
|
- /View commit fe29668 by Charlie Bear/
|
|
|
|
- );
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
});
|
|
});
|