Skip to content

Commit 8bda18c

Browse files
evanpurkhiserlzhao-sentry
authored andcommitted
ref(js): Remove ModalStore calls from tests (#98054)
Any open modals will now always be closed for tests
1 parent 6dd2fce commit 8bda18c

File tree

33 files changed

+12
-89
lines changed

33 files changed

+12
-89
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import ModalStore from 'sentry/stores/modalStore';
1+
import {openModal} from 'sentry/actionCreators/modal';
22

33
export async function redirectToProject(newProjectSlug: string) {
44
const {default: Modal} = await import('sentry/components/modals/redirectToProject');
55

6-
ModalStore.openModal(deps => <Modal {...deps} slug={newProjectSlug} />, {});
6+
openModal(deps => <Modal {...deps} slug={newProjectSlug} />, {});
77
}

static/app/actionCreators/sudoModal.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type {ModalOptions} from 'sentry/actionCreators/modal';
2-
import ModalStore from 'sentry/stores/modalStore';
1+
import {openModal, type ModalOptions} from 'sentry/actionCreators/modal';
32

43
type OpenSudoModalOptions = ModalOptions & {
54
closeButton?: boolean;
@@ -17,5 +16,5 @@ export async function openSudo({
1716
}: OpenSudoModalOptions = {}) {
1817
const {default: Modal} = await import('sentry/components/modals/sudoModal');
1918

20-
ModalStore.openModal(deps => <Modal {...deps} {...args} />, {onClose, closeEvents});
19+
openModal(deps => <Modal {...deps} {...args} />, {onClose, closeEvents});
2120
}

static/app/components/acl/featureDisabledModal.spec.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import styled from '@emotion/styled';
44
import {render, screen} from 'sentry-test/reactTestingLibrary';
55

66
import {FeatureDisabledModal} from 'sentry/components/acl/featureDisabledModal';
7-
import ModalStore from 'sentry/stores/modalStore';
87

98
describe('FeatureTourModal', () => {
109
const onCloseModal = jest.fn();
@@ -26,7 +25,6 @@ describe('FeatureTourModal', () => {
2625
);
2726

2827
beforeEach(() => {
29-
ModalStore.reset();
3028
jest.clearAllMocks();
3129
});
3230

static/app/components/actions/resolve.spec.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ import {
1010
import selectEvent from 'sentry-test/selectEvent';
1111

1212
import ResolveActions from 'sentry/components/actions/resolve';
13-
import ModalStore from 'sentry/stores/modalStore';
1413

1514
describe('ResolveActions', () => {
1615
const spy = jest.fn();
17-
beforeEach(() => {
18-
ModalStore.reset();
19-
});
2016
afterEach(() => {
2117
spy.mockClear();
2218
MockApiClient.clearMockResponses();

static/app/components/confirm.spec.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ import {
1010
} from 'sentry-test/reactTestingLibrary';
1111

1212
import Confirm from 'sentry/components/confirm';
13-
import ModalStore from 'sentry/stores/modalStore';
1413

1514
describe('Confirm', () => {
1615
beforeEach(() => {
1716
jest.useRealTimers();
1817
});
19-
afterEach(() => {
20-
ModalStore.reset();
21-
});
2218

2319
it('renders', () => {
2420
const mock = jest.fn();

static/app/components/confirmDelete.spec.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@ import {
66
} from 'sentry-test/reactTestingLibrary';
77

88
import ConfirmDelete from 'sentry/components/confirmDelete';
9-
import ModalStore from 'sentry/stores/modalStore';
109

1110
describe('ConfirmDelete', () => {
12-
afterEach(() => {
13-
ModalStore.reset();
14-
});
15-
1611
it('renders', async () => {
1712
const mock = jest.fn();
1813
render(

static/app/components/events/eventTags/eventTagsTree.spec.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
} from 'sentry-test/reactTestingLibrary';
1414

1515
import {EventTags} from 'sentry/components/events/eventTags';
16-
import ModalStore from 'sentry/stores/modalStore';
1716

1817
describe('EventTagsTree', () => {
1918
const {organization, project} = initializeOrg();
@@ -67,7 +66,6 @@ describe('EventTagsTree', () => {
6766
let mockDetailedProject: jest.Mock;
6867

6968
beforeEach(() => {
70-
ModalStore.reset();
7169
MockApiClient.clearMockResponses();
7270
mockDetailedProject = MockApiClient.addMockResponse({
7371
url: `/projects/${organization.slug}/${project.slug}/`,

static/app/components/events/highlights/editHighlightsModal.spec.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {openModal} from 'sentry/actionCreators/modal';
1414
import EditHighlightsModal, {
1515
type EditHighlightsModalProps,
1616
} from 'sentry/components/events/highlights/editHighlightsModal';
17-
import ModalStore from 'sentry/stores/modalStore';
1817
import type {Project} from 'sentry/types/project';
1918
import * as analytics from 'sentry/utils/analytics';
2019

@@ -77,7 +76,6 @@ describe('EditHighlightsModal', () => {
7776
beforeEach(() => {
7877
MockApiClient.clearMockResponses();
7978
jest.resetAllMocks();
80-
ModalStore.reset();
8179
});
8280

8381
it('should renders with basic functions', async () => {

static/app/components/events/interfaces/debugMeta/index.spec.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ import {
1212
} from 'sentry-test/reactTestingLibrary';
1313

1414
import {DebugMeta} from 'sentry/components/events/interfaces/debugMeta';
15-
import ModalStore from 'sentry/stores/modalStore';
1615
import {ImageStatus} from 'sentry/types/debugImage';
1716

1817
describe('DebugMeta', () => {
1918
const {organization, project} = initializeOrg();
2019

2120
beforeEach(() => {
2221
MockApiClient.clearMockResponses();
23-
ModalStore.reset();
2422
});
2523

2624
it('opens details modal', async () => {

static/app/components/featureFeedback/index.spec.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@ import {
66
} from 'sentry-test/reactTestingLibrary';
77

88
import {FeatureFeedback} from 'sentry/components/featureFeedback';
9-
import ModalStore from 'sentry/stores/modalStore';
109

1110
describe('FeatureFeedback', () => {
12-
beforeEach(() => {
13-
ModalStore.reset();
14-
});
15-
1611
it('shows the modal on click', async () => {
1712
render(<FeatureFeedback featureName="test" />);
1813
renderGlobalModal();

0 commit comments

Comments
 (0)