Browse Source

test(js): Remove some browserHistory from tests (#82581)

It's already assigned jest mocks
Evan Purkhiser 2 months ago
parent
commit
63eb539093

+ 0 - 1
static/app/views/alerts/rules/issue/details/ruleDetails.spec.tsx

@@ -41,7 +41,6 @@ describe('AlertRuleDetails', () => {
   };
 
   beforeEach(() => {
-    browserHistory.push = jest.fn();
     MockApiClient.addMockResponse({
       url: `/projects/${organization.slug}/${project.slug}/rules/${rule.id}/`,
       body: rule,

+ 0 - 1
static/app/views/alerts/rules/issue/index.spec.tsx

@@ -125,7 +125,6 @@ const createWrapper = (props = {}) => {
 describe('IssueRuleEditor', function () {
   beforeEach(function () {
     MockApiClient.clearMockResponses();
-    browserHistory.replace = jest.fn();
     MockApiClient.addMockResponse({
       url: '/projects/org-slug/project-slug/rules/configuration/',
       body: ProjectAlertRuleConfigurationFixture(),

+ 0 - 1
static/app/views/performance/content.spec.tsx

@@ -75,7 +75,6 @@ function initializeTrendsData(query, addDefaultQuery = true) {
 describe('Performance > Content', function () {
   beforeEach(function () {
     act(() => void TeamStore.loadInitialData([], false, null));
-    browserHistory.push = jest.fn();
     jest.spyOn(pageFilters, 'updateDateTime');
 
     MockApiClient.addMockResponse({

+ 0 - 1
static/app/views/performance/table.spec.tsx

@@ -109,7 +109,6 @@ function mockEventView(data) {
 describe('Performance > Table', function () {
   let eventsMock;
   beforeEach(function () {
-    browserHistory.push = jest.fn();
     mockUseLocation.mockReturnValue(
       LocationFixture({pathname: '/organizations/org-slug/performance/summary'})
     );

+ 1 - 2
static/app/views/performance/transactionSummary/transactionSpans/spanDetails/index.spec.tsx

@@ -38,8 +38,7 @@ describe('Performance > Transaction Spans > Span Summary', function () {
   afterEach(function () {
     MockApiClient.clearMockResponses();
     ProjectsStore.reset();
-    // need to typecast to any to be able to call mockReset
-    (browserHistory.push as any).mockReset();
+    jest.mocked(browserHistory.push).mockReset();
   });
 
   describe('Without Span Data', function () {

+ 0 - 1
static/app/views/performance/transactionSummary/transactionTags/index.spec.tsx

@@ -55,7 +55,6 @@ describe('Performance > Transaction Tags', function () {
     mockUseLocation.mockReturnValue(
       LocationFixture({pathname: '/organizations/org-slug/performance/summary/tags/'})
     );
-    browserHistory.replace = jest.fn();
     MockApiClient.addMockResponse({
       url: '/organizations/org-slug/projects/',
       body: [],

+ 1 - 2
static/app/views/performance/trends/index.spec.tsx

@@ -176,7 +176,6 @@ describe('Performance > Trends', function () {
       state: undefined,
     });
 
-    browserHistory.push = jest.fn();
     MockApiClient.addMockResponse({
       url: '/organizations/org-slug/projects/',
       body: [],
@@ -747,7 +746,7 @@ describe('Performance > Trends', function () {
       }
     );
 
-    (browserHistory.push as any).mockReset();
+    jest.mocked(browserHistory.push).mockReset();
 
     const byTransactionLink = await screen.findByTestId('breadcrumb-link');
 

+ 0 - 1
static/app/views/performance/vitalDetail/index.spec.tsx

@@ -74,7 +74,6 @@ describe('Performance > VitalDetail', function () {
   beforeEach(function () {
     TeamStore.loadInitialData([], false, null);
     ProjectsStore.loadInitialData([project]);
-    browserHistory.push = jest.fn();
     MockApiClient.addMockResponse({
       url: `/organizations/${organization.slug}/projects/`,
       body: [],