From 1c323486015305f817693b5d8a5aa6b574546bdb Mon Sep 17 00:00:00 2001 From: Ajoy Kumar Das Date: Sat, 20 Jan 2024 11:19:35 +0530 Subject: [PATCH 1/2] fix:failing tests --- .../components/UserProfileWithGitHubLogin.tsx | 2 +- .../NewMemberSection/NewMemberCard/index.tsx | 4 +-- .../components/navbar/NavbarDesktop.test.tsx | 4 --- .../new-member-card/NewMembersCard.test.js | 26 +++++++++----- .../__snapshots__/NewMembersCard.test.js.snap | 34 +++++++++---------- 5 files changed, 36 insertions(+), 34 deletions(-) diff --git a/src/components/Layout/Navbar/components/UserProfileWithGitHubLogin.tsx b/src/components/Layout/Navbar/components/UserProfileWithGitHubLogin.tsx index dfc54be..edf7251 100644 --- a/src/components/Layout/Navbar/components/UserProfileWithGitHubLogin.tsx +++ b/src/components/Layout/Navbar/components/UserProfileWithGitHubLogin.tsx @@ -2,7 +2,7 @@ import { Box, Button, Text } from "@chakra-ui/react"; import Image from "next/image"; import Link from "next/link"; import { Dispatch, FC, SetStateAction } from "react"; -import { getAuthUrl } from "@/src/utils/auth"; +import { getAuthUrl } from "../../../../utils/auth"; import { NavbarTypes } from "../types/navbar"; import dummyImage from "../../../../../public/images/Avatar.png"; diff --git a/src/components/NewMemberSection/NewMemberCard/index.tsx b/src/components/NewMemberSection/NewMemberCard/index.tsx index f7dd402..ae0937d 100644 --- a/src/components/NewMemberSection/NewMemberCard/index.tsx +++ b/src/components/NewMemberSection/NewMemberCard/index.tsx @@ -4,9 +4,9 @@ import { useDispatch, useSelector } from "react-redux"; import { setIsUserRoleUpdateModalVisible, setUserSkillModalVisibility, -} from "@/src/store/superUserOptions"; +} from "../../../store/superUserOptions"; import { RootState } from "@/src/store"; -import { useGetIsSuperUser } from "@/src/utils/customHooks"; +import { useGetIsSuperUser } from "../../../utils/customHooks"; import { useRouter } from "next/router"; import { UserType } from "../../MembersSectionNew/types/MembersSection.type"; diff --git a/src/test/unit/components/navbar/NavbarDesktop.test.tsx b/src/test/unit/components/navbar/NavbarDesktop.test.tsx index 3f25f6b..b92f027 100644 --- a/src/test/unit/components/navbar/NavbarDesktop.test.tsx +++ b/src/test/unit/components/navbar/NavbarDesktop.test.tsx @@ -11,7 +11,6 @@ describe("NavbarDesktop component", () => { renderWithProviders( { renderWithProviders( { renderWithProviders( { renderWithProviders( ({ + useRouter() { + return { + route: "/", + pathname: "", + query: "", + asPath: "", + }; + }, + })); describe("NewMembersCard", () => { it("renders the component", () => { - const newMemberFirstName = "Sunny"; - const newMemberLastName = "Kumar"; - const newMemberImageSrc = "/../../../public/images/Avatar.png"; + const user = userData; - const { container } = render( + const { container } = renderWithProviders( ); expect(container).toMatchSnapshot(); diff --git a/src/test/unit/components/new-member-card/__snapshots__/NewMembersCard.test.js.snap b/src/test/unit/components/new-member-card/__snapshots__/NewMembersCard.test.js.snap index 6ca5600..96ccf1e 100644 --- a/src/test/unit/components/new-member-card/__snapshots__/NewMembersCard.test.js.snap +++ b/src/test/unit/components/new-member-card/__snapshots__/NewMembersCard.test.js.snap @@ -2,34 +2,32 @@ exports[`NewMembersCard renders the component 1`] = `
-
Sunny Kumar -

- Sunny Kumar -

+

+ vinayak trivedi +

-
+
`; From 26c6c1666196026c522050a4d31c14a74b18e48d Mon Sep 17 00:00:00 2001 From: Ajoy Kumar Das Date: Sat, 20 Jan 2024 15:39:33 +0530 Subject: [PATCH 2/2] chore:fix-merge-conflicts --- .../components/UserProfileWithGitHubLogin.tsx | 10 +--- .../new-member-card/NewMembersCard.test.js | 58 +++++-------------- 2 files changed, 17 insertions(+), 51 deletions(-) diff --git a/src/components/Layout/Navbar/components/UserProfileWithGitHubLogin.tsx b/src/components/Layout/Navbar/components/UserProfileWithGitHubLogin.tsx index 86092cd..e8544a1 100644 --- a/src/components/Layout/Navbar/components/UserProfileWithGitHubLogin.tsx +++ b/src/components/Layout/Navbar/components/UserProfileWithGitHubLogin.tsx @@ -1,16 +1,8 @@ -<<<<<<< HEAD -import { Box, Button, Text } from "@chakra-ui/react"; -import Image from "next/image"; -import Link from "next/link"; -import { Dispatch, FC, SetStateAction } from "react"; -import { getAuthUrl } from "../../../../utils/auth"; -======= import { Box, Button, Text } from '@chakra-ui/react'; import Image from 'next/image'; import Link from 'next/link'; import { Dispatch, FC, SetStateAction } from 'react'; -import { getAuthUrl } from '@/src/utils/auth'; ->>>>>>> develop +import { getAuthUrl } from '../../../../utils/auth'; import { NavbarTypes } from '../types/navbar'; import dummyImage from '../../../../../public/images/Avatar.png'; diff --git a/src/test/unit/components/new-member-card/NewMembersCard.test.js b/src/test/unit/components/new-member-card/NewMembersCard.test.js index 6ccb973..3cad68e 100644 --- a/src/test/unit/components/new-member-card/NewMembersCard.test.js +++ b/src/test/unit/components/new-member-card/NewMembersCard.test.js @@ -1,50 +1,24 @@ -<<<<<<< HEAD -import { renderWithProviders } from "../../../../test__utils/renderWithProvides"; -import React from "react"; -import NewMembersCard from "../../../../components/NewMemberSection/NewMemberCard/index"; -import { userData } from "../../../../mocks/db/user"; - -jest.mock("next/router", () => ({ - useRouter() { - return { - route: "/", - pathname: "", - query: "", - asPath: "", - }; - }, - })); - -describe("NewMembersCard", () => { - it("renders the component", () => { - const user = userData; - - const { container } = renderWithProviders( - - ); - expect(container).toMatchSnapshot(); - }); -======= -import { render } from '@testing-library/react'; +import { renderWithProviders } from '../../../../test__utils/renderWithProvides'; import React from 'react'; -import NewMembersCard from './../../../../../src/components/NewMember/index'; +import NewMembersCard from '../../../../components/NewMemberSection/NewMemberCard/index'; +import { userData } from '../../../../mocks/db/user'; + +jest.mock('next/router', () => ({ + useRouter() { + return { + route: '/', + pathname: '', + query: '', + asPath: '', + }; + }, +})); describe('NewMembersCard', () => { it('renders the component', () => { - const newMemberFirstName = 'Sunny'; - const newMemberLastName = 'Kumar'; - const newMemberImageSrc = '/../../../public/images/Avatar.png'; + const user = userData; - const { container } = render( - , - ); + const { container } = renderWithProviders(); expect(container).toMatchSnapshot(); }); ->>>>>>> develop });