From aa1468ad4f7e03b2b8391fd12f650a7daa6c01a9 Mon Sep 17 00:00:00 2001 From: zuies Date: Thu, 14 Sep 2023 15:50:11 +0300 Subject: [PATCH] mock router in test cases --- src/components/pages/statistics/Onboarding.spec.tsx | 1 + .../activeMembers/ActiveMemberBreakdown.spec.tsx | 1 + .../DisengagedMembersCompositionBreakdown.spec.tsx | 1 + .../onboardingMembers/OnboardingMembersBreakdown.spec.tsx | 1 + 4 files changed, 4 insertions(+) diff --git a/src/components/pages/statistics/Onboarding.spec.tsx b/src/components/pages/statistics/Onboarding.spec.tsx index e140efa7..3cce1606 100644 --- a/src/components/pages/statistics/Onboarding.spec.tsx +++ b/src/components/pages/statistics/Onboarding.spec.tsx @@ -1,6 +1,7 @@ import { render, screen } from '@testing-library/react'; import Onboarding from './Onboarding'; import { communityActiveDates } from '../../../lib/data/dateRangeValues'; +jest.mock('next/router', () => require('next-router-mock')); describe('Onboarding component', () => { const mockActivePeriod = 1; diff --git a/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.spec.tsx b/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.spec.tsx index 1d21b973..e175707b 100644 --- a/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.spec.tsx +++ b/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.spec.tsx @@ -1,5 +1,6 @@ import { render, screen } from '@testing-library/react'; import ActiveMemberBreakdown from './ActiveMemberBreakdown'; +jest.mock('next/router', () => require('next-router-mock')); describe('ActiveMemberBreakdown', () => { it('renders the component', () => { diff --git a/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.spec.tsx b/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.spec.tsx index 5d0ca59f..1ec85f55 100644 --- a/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.spec.tsx +++ b/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.spec.tsx @@ -1,5 +1,6 @@ import { render, screen } from '@testing-library/react'; import DisengagedMembersCompositionBreakdown from './DisengagedMembersCompositionBreakdown'; +jest.mock('next/router', () => require('next-router-mock')); describe('ActiveMemberBreakdown', () => { it('renders the component', () => { diff --git a/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.spec.tsx b/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.spec.tsx index 4053135f..34274109 100644 --- a/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.spec.tsx +++ b/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.spec.tsx @@ -1,5 +1,6 @@ import { render, screen } from '@testing-library/react'; import OnboardingMembersBreakdown from './OnboardingMembersBreakdown'; +jest.mock('next/router', () => require('next-router-mock')); describe('ActiveMemberBreakdown', () => { it('renders the component', () => {