From a80c5850af92186832e25399fc8b780d02bc0dd4 Mon Sep 17 00:00:00 2001 From: zuies Date: Fri, 1 Dec 2023 14:05:15 +0300 Subject: [PATCH] update unit tests --- src/components/pages/statistics/Onboarding.spec.tsx | 11 +++++++---- .../activeMembers/ActiveMemberBreakdown.spec.tsx | 8 ++++++-- .../DisengagedMembersCompositionBreakdown.spec.tsx | 8 ++++++-- .../DisengagedMembersCompositionBreakdown.tsx | 2 -- .../OnboardingMembersBreakdown.spec.tsx | 8 ++++++-- .../onboardingMembers/OnboardingMembersBreakdown.tsx | 2 -- src/pages/community-health.tsx | 2 -- src/pages/membersInteraction.tsx | 1 - 8 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/components/pages/statistics/Onboarding.spec.tsx b/src/components/pages/statistics/Onboarding.spec.tsx index 3cce1606..4c6b55b2 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'; +import { TokenProvider } from '../../../context/TokenContext'; jest.mock('next/router', () => require('next-router-mock')); describe('Onboarding component', () => { @@ -9,10 +10,12 @@ describe('Onboarding component', () => { beforeEach(() => { render( - + + + ); }); diff --git a/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.spec.tsx b/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.spec.tsx index e175707b..822e50e2 100644 --- a/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.spec.tsx +++ b/src/components/pages/statistics/memberBreakdowns/activeMembers/ActiveMemberBreakdown.spec.tsx @@ -1,12 +1,16 @@ import { render, screen } from '@testing-library/react'; import ActiveMemberBreakdown from './ActiveMemberBreakdown'; +import { TokenProvider } from '../../../../../context/TokenContext'; jest.mock('next/router', () => require('next-router-mock')); describe('ActiveMemberBreakdown', () => { it('renders the component', () => { - render(); + render( + + + + ); - // Assert the component is rendered const component = screen.getByText('Members breakdown'); expect(component).toBeInTheDocument(); }); diff --git a/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.spec.tsx b/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.spec.tsx index 1ec85f55..cb15c3f9 100644 --- a/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.spec.tsx +++ b/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.spec.tsx @@ -1,12 +1,16 @@ import { render, screen } from '@testing-library/react'; +import { TokenProvider } from '../../../../../context/TokenContext'; import DisengagedMembersCompositionBreakdown from './DisengagedMembersCompositionBreakdown'; jest.mock('next/router', () => require('next-router-mock')); describe('ActiveMemberBreakdown', () => { it('renders the component', () => { - render(); + render( + + + + ); - // Assert the component is rendered const component = screen.getByText('Members breakdown'); expect(component).toBeInTheDocument(); }); diff --git a/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx b/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx index 35f70679..565dbdd4 100644 --- a/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx +++ b/src/components/pages/statistics/memberBreakdowns/disengagedMembersComposition/DisengagedMembersCompositionBreakdown.tsx @@ -1,7 +1,5 @@ import { useState, useEffect, useRef } from 'react'; -import { StorageService } from '../../../../../services/StorageService'; import useAppStore from '../../../../../store/useStore'; -import { IUser } from '../../../../../utils/types'; import CustomTable from '../CustomTable'; import { Column, diff --git a/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.spec.tsx b/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.spec.tsx index 34274109..cfba1d8b 100644 --- a/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.spec.tsx +++ b/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.spec.tsx @@ -1,12 +1,16 @@ import { render, screen } from '@testing-library/react'; +import { TokenProvider } from '../../../../../context/TokenContext'; import OnboardingMembersBreakdown from './OnboardingMembersBreakdown'; jest.mock('next/router', () => require('next-router-mock')); describe('ActiveMemberBreakdown', () => { it('renders the component', () => { - render(); + render( + + + + ); - // Assert the component is rendered const component = screen.getByText('Members breakdown'); expect(component).toBeInTheDocument(); }); diff --git a/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx b/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx index 525af241..1129ae9c 100644 --- a/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx +++ b/src/components/pages/statistics/memberBreakdowns/onboardingMembers/OnboardingMembersBreakdown.tsx @@ -1,7 +1,5 @@ import { useState, useEffect, useRef } from 'react'; -import { StorageService } from '../../../../../services/StorageService'; import useAppStore from '../../../../../store/useStore'; -import { IUser } from '../../../../../utils/types'; import CustomTable from '../CustomTable'; import { Column, diff --git a/src/pages/community-health.tsx b/src/pages/community-health.tsx index 8c53c6d8..47c63727 100644 --- a/src/pages/community-health.tsx +++ b/src/pages/community-health.tsx @@ -5,8 +5,6 @@ import Fragmentation from '../components/pages/communityHealth/Fragmentation'; import Decentralization from '../components/pages/communityHealth/Decentralization'; import HeaderSection from '../components/pages/communityHealth/HeaderSection'; import useAppStore from '../store/useStore'; -import { StorageService } from '../services/StorageService'; -import { IUser } from '../utils/types'; import SimpleBackdrop from '../components/global/LoadingBackdrop'; import { IDecentralisationScoreResponse, diff --git a/src/pages/membersInteraction.tsx b/src/pages/membersInteraction.tsx index bebcdfb9..c52bb057 100644 --- a/src/pages/membersInteraction.tsx +++ b/src/pages/membersInteraction.tsx @@ -5,7 +5,6 @@ import { AiOutlineExclamationCircle, AiOutlineLeft } from 'react-icons/ai'; import Link from '../components/global/Link'; import { Paper, Popover } from '@mui/material'; import useAppStore from '../store/useStore'; -import { StorageService } from '../services/StorageService'; import HintBox from '../components/pages/memberInteraction/HintBox'; import { IUser } from '../utils/types'; import SimpleBackdrop from '../components/global/LoadingBackdrop';