Browse Source

test: Speed up issuelist actions test speed, reduce listeners (#26443)

Scott Cooper 3 years ago
parent
commit
8882da80d8

+ 0 - 2
static/app/views/issueList/actions/index.tsx

@@ -38,7 +38,6 @@ type Props = {
 };
 
 type State = {
-  datePickerActive: boolean;
   anySelected: boolean;
   multiSelected: boolean;
   pageSelected: boolean;
@@ -49,7 +48,6 @@ type State = {
 
 class IssueListActions extends React.Component<Props, State> {
   state: State = {
-    datePickerActive: false,
     anySelected: false,
     multiSelected: false, // more than one selected
     pageSelected: false, // all on current page selected (e.g. 25)

+ 29 - 5
tests/js/spec/views/issueList/actions.spec.jsx

@@ -9,6 +9,7 @@ import {IssueListActions} from 'app/views/issueList/actions';
 
 describe('IssueListActions', function () {
   let actions;
+  let actionsWrapper;
   let wrapper;
 
   afterEach(() => {
@@ -45,6 +46,10 @@ describe('IssueListActions', function () {
         );
       });
 
+      afterAll(() => {
+        wrapper.unmount();
+      });
+
       it('after checking "Select all" checkbox, displays bulk select message', async function () {
         wrapper.find('ActionsCheckbox Checkbox').simulate('change');
         expect(wrapper.find('SelectAllNotice')).toSnapshot();
@@ -110,6 +115,10 @@ describe('IssueListActions', function () {
         );
       });
 
+      afterAll(() => {
+        wrapper.unmount();
+      });
+
       it('after checking "Select all" checkbox, displays bulk select message', async function () {
         wrapper.find('ActionsCheckbox Checkbox').simulate('change');
         expect(wrapper.find('SelectAllNotice')).toSnapshot();
@@ -174,6 +183,10 @@ describe('IssueListActions', function () {
         );
       });
 
+      afterAll(() => {
+        wrapper.unmount();
+      });
+
       it('resolves selected items', function () {
         const apiMock = MockApiClient.addMockResponse({
           url: '/organizations/org-slug/issues/',
@@ -248,7 +261,7 @@ describe('IssueListActions', function () {
   describe('actionSelectedGroups()', function () {
     beforeEach(function () {
       jest.spyOn(SelectedGroupStore, 'deselectAll');
-      actions = mountWithTheme(
+      actionsWrapper = mountWithTheme(
         <IssueListActions
           api={new MockApiClient()}
           query=""
@@ -265,7 +278,12 @@ describe('IssueListActions', function () {
           realtimeActive={false}
           statsPeriod="24h"
         />
-      ).instance();
+      );
+      actions = actionsWrapper.instance();
+    });
+
+    afterEach(() => {
+      actionsWrapper.unmount();
     });
 
     describe('for all items', function () {
@@ -328,6 +346,10 @@ describe('IssueListActions', function () {
       );
     });
 
+    afterEach(() => {
+      wrapper.unmount();
+    });
+
     it('should disable resolve dropdown but not resolve action', function () {
       const resolve = wrapper.find('ResolveActions').first();
       expect(resolve.props().disabled).toBe(false);
@@ -346,9 +368,7 @@ describe('IssueListActions', function () {
   describe('with inbox feature', function () {
     let issuesApiMock;
     beforeEach(async () => {
-      GroupStore.init();
-      SelectedGroupStore.init();
-      await tick();
+      SelectedGroupStore.records = {};
       const {organization} = TestStubs.routerContext().context;
       wrapper = mountWithTheme(
         <IssueListActions
@@ -381,6 +401,10 @@ describe('IssueListActions', function () {
       });
     });
 
+    afterEach(() => {
+      wrapper.unmount();
+    });
+
     it('acknowledges group', async function () {
       wrapper.find('IssueListActions').setState({anySelected: true});
       SelectedGroupStore.add(['1', '2', '3']);