Files
2024-02-15 17:01:50 +00:00

116 lines
3.2 KiB
TypeScript

import {CommitFixture} from 'sentry-fixture/commit';
import {ProjectFixture} from 'sentry-fixture/project';
import {UserFixture} from 'sentry-fixture/user';
import {render} from 'sentry-test/reactTestingLibrary';
import {GroupActivityType} from 'sentry/types';
import ResolutionBox from './resolutionBox';
describe('ResolutionBox', function () {
it('handles default', function () {
const {container} = render(<ResolutionBox statusDetails={{}} projectId="1" />);
expect(container).toHaveTextContent('This issue has been marked as resolved.');
});
it('handles inNextRelease', function () {
const {container} = render(
<ResolutionBox statusDetails={{inNextRelease: true}} projectId="1" />
);
expect(container).toHaveTextContent(
'This issue has been marked as resolved in the upcoming release.'
);
});
it('handles inNextRelease with actor', function () {
const {container} = render(
<ResolutionBox
statusDetails={{
inNextRelease: true,
actor: {
id: '111',
name: 'David Cramer',
username: 'dcramer',
ip_address: '127.0.0.1',
email: '[email protected]',
},
}}
projectId="1"
/>
);
expect(container).toHaveTextContent(
'David Cramer marked this issue as resolved in the upcoming release.'
);
});
it('handles in next release (semver current_release_version)', function () {
const {container} = render(
<ResolutionBox
statusDetails={{
inNextRelease: true,
actor: UserFixture(),
}}
projectId="1"
activities={[
{
id: '1',
type: GroupActivityType.SET_RESOLVED_IN_RELEASE,
data: {
current_release_version: '[email protected]',
},
dateCreated: new Date().toISOString(),
project: ProjectFixture(),
},
]}
/>
);
expect(container).toHaveTextContent(
'Foo Bar marked this issue as resolved in versions greater than 1.0.0'
);
});
it('handles inRelease', function () {
const {container} = render(
<ResolutionBox
statusDetails={{
inRelease: '1.0',
}}
projectId="1"
/>
);
expect(container).toHaveTextContent(
'This issue has been marked as resolved in version 1.0.'
);
});
it('handles inRelease with actor', function () {
const {container} = render(
<ResolutionBox
statusDetails={{
inRelease: '1.0',
actor: {
id: '111',
name: 'David Cramer',
username: 'dcramer',
ip_address: '127.0.0.1',
email: '[email protected]',
},
}}
projectId="1"
/>
);
expect(container).toHaveTextContent(
'David Cramer marked this issue as resolved in version 1.0.'
);
});
it('handles inCommit', function () {
const {container} = render(
<ResolutionBox
statusDetails={{
inCommit: CommitFixture(),
}}
projectId="1"
/>
);
expect(container).toHaveTextContent(
'This issue has been marked as resolved by f7f395din'
);
});
});