1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- import * as PropTypes from 'prop-types';
- import {mountWithTheme} from 'sentry-test/enzyme';
- import {Client} from 'sentry/api';
- import GroupingStore from 'sentry/stores/groupingStore';
- import {GroupMergedView} from 'sentry/views/organizationGroupDetails/groupMerged';
- jest.mock('sentry/api');
- describe('Issues -> Merged View', function () {
- const events = TestStubs.DetailedEvents();
- const mockData = {
- merged: [
- {
- latestEvent: events[0],
- state: 'unlocked',
- id: '2c4887696f708c476a81ce4e834c4b02',
- },
- {
- latestEvent: events[1],
- state: 'unlocked',
- id: 'e05da55328a860b21f62e371f0a7507d',
- },
- ],
- };
- const context = {
- group: {
- id: 'id',
- tags: [],
- },
- };
- beforeAll(function () {
- Client.addMockResponse({
- url: '/issues/groupId/hashes/?limit=50&query=',
- body: mockData.merged,
- });
- });
- beforeEach(() => {
- GroupingStore.init();
- });
- afterEach(() => {
- GroupingStore.teardown();
- });
- it('renders initially with loading component', function () {
- const wrapper = mountWithTheme(
- <GroupMergedView
- project={TestStubs.Project({slug: 'projectId'})}
- params={{orgId: 'orgId', projectId: 'projectId', groupId: 'groupId'}}
- location={{query: {}}}
- />,
- TestStubs.routerContext()
- );
- expect(wrapper.find('LoadingIndicator')).toHaveLength(1);
- });
- it('renders with mocked data', async function () {
- const wrapper = mountWithTheme(
- <GroupMergedView
- project={TestStubs.Project({slug: 'projectId'})}
- params={{orgId: 'orgId', projectId: 'projectId', groupId: 'groupId'}}
- location={{query: {}}}
- />,
- {
- ...TestStubs.routerContext([
- {
- group: context,
- },
- {
- group: PropTypes.object,
- },
- ]),
- }
- );
- await tick();
- await tick();
- wrapper.update();
- expect(wrapper.find('LoadingIndicator')).toHaveLength(0);
- expect(wrapper).toSnapshot();
- });
- });
|