Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Failing Tests #134

Merged
merged 3 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions src/components/NewMemberSection/NewMemberCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
4 changes: 0 additions & 4 deletions src/test/unit/components/navbar/NavbarDesktop.test.tsx
sahsisunny marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ describe('NavbarDesktop component', () => {
renderWithProviders(
<NavbarDesktop
isLoggedIn={false}
isDropdownVisible={false}
firstName={null}
imageURL={null}
setIsDropdownVisible={setIsDropdownVisible}
Expand All @@ -32,7 +31,6 @@ describe('NavbarDesktop component', () => {
renderWithProviders(
<NavbarDesktop
isLoggedIn={false}
isDropdownVisible={false}
firstName={null}
imageURL={null}
setIsDropdownVisible={setIsDropdownVisible}
Expand Down Expand Up @@ -60,7 +58,6 @@ describe('NavbarDesktop component', () => {
renderWithProviders(
<NavbarDesktop
isLoggedIn={false}
isDropdownVisible={false}
firstName={null}
imageURL={null}
setIsDropdownVisible={setIsDropdownVisible}
Expand Down Expand Up @@ -107,7 +104,6 @@ describe('NavbarDesktop component', () => {
renderWithProviders(
<NavbarDesktop
isLoggedIn={true}
isDropdownVisible={false}
firstName={first_name}
imageURL={imageURL}
setIsDropdownVisible={setIsDropdownVisible}
Expand Down
28 changes: 16 additions & 12 deletions src/test/unit/components/new-member-card/NewMembersCard.test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
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(
<NewMembersCard
newMemberFirstName={newMemberFirstName}
newMemberLastName={newMemberLastName}
newMemberImageSrc={newMemberImageSrc}
/>,
);
const { container } = renderWithProviders(<NewMembersCard user={user} />);
expect(container).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,32 @@

exports[`NewMembersCard renders the component 1`] = `
<div>
<div
class="flex bg-white max-w-sm rounded-md transition-shadow duration-300 h-35 overflow-hidden"
<button
class="new_user_container css-0"
>
<div
class="p-4 rounded-md"
class="new_user_main css-0"
>
<div
class="text-center p-2"
class="new_user__image_container css-0"
>
<img
alt="Sunny Kumar"
class="rounded-full mx-auto"
data-nimg="1"
alt=""
data-nimg="fill"
decoding="async"
height="60"
loading="lazy"
src="/_next/image?url=%2F..%2F..%2F..%2Fpublic%2Fimages%2FAvatar.png&w=128&q=75"
srcset="/_next/image?url=%2F..%2F..%2F..%2Fpublic%2Fimages%2FAvatar.png&w=64&q=75 1x, /_next/image?url=%2F..%2F..%2F..%2Fpublic%2Fimages%2FAvatar.png&w=128&q=75 2x"
style="color: transparent;"
width="60"
sizes="100vw"
src="/_next/image?url=%2Fimages%2FAvatar.png&w=3840&q=75"
srcset="/_next/image?url=%2Fimages%2FAvatar.png&w=640&q=75 640w, /_next/image?url=%2Fimages%2FAvatar.png&w=750&q=75 750w, /_next/image?url=%2Fimages%2FAvatar.png&w=828&q=75 828w, /_next/image?url=%2Fimages%2FAvatar.png&w=1080&q=75 1080w, /_next/image?url=%2Fimages%2FAvatar.png&w=1200&q=75 1200w, /_next/image?url=%2Fimages%2FAvatar.png&w=1920&q=75 1920w, /_next/image?url=%2Fimages%2FAvatar.png&w=2048&q=75 2048w, /_next/image?url=%2Fimages%2FAvatar.png&w=3840&q=75 3840w"
style="position: absolute; height: 100%; width: 100%; left: 0px; top: 0px; right: 0px; bottom: 0px; color: transparent; border-radius: 50%;"
/>
<p
class="py-2 font-bold"
>
Sunny Kumar
</p>
</div>
<p
class="chakra-text css-0"
>
vinayak trivedi
</p>
</div>
</div>
</button>
</div>
`;