Skip to content

Commit

Permalink
test: item bottom snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiShandy committed Oct 22, 2023
1 parent e44e60a commit bb55e60
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
36 changes: 36 additions & 0 deletions components/molecules/Navbar/ItemBottom.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { render } from '@testing-library/react';
import ItemBottom from './ItemBottom';
import { DrawContext } from '@/pages/_app';
import { SessionProvider } from 'next-auth/react';
import { QueryClient, QueryClientProvider } from 'react-query';
import { SlHome } from 'react-icons/sl';


jest.mock('next/router', () => ({
useRouter: jest.fn().mockReturnValue({
query: {
'payment-intent': 'pi_1J4JrjGswQjYFZwX0Z1Z1Z1Z',
},
}),
}));

describe('ItemBottom', () => {
it('should render the component', () => {
const { container } = render(
<SessionProvider session={{ user: { data: { userId: 'testUser123' } } }}>
<DrawContext.Provider value={{ draw: false, setDraw: jest.fn() }}>
<QueryClientProvider client={new QueryClient()}>
<ItemBottom
title='Accueil'
icon={({ size, className }) => (
<SlHome size={size} className={className} />
)}
link='/'
/>
</QueryClientProvider>
</DrawContext.Provider>
</SessionProvider>,
);
expect(container).toMatchSnapshot();
});
});
32 changes: 32 additions & 0 deletions components/molecules/Navbar/__snapshots__/ItemBottom.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ItemBottom should render the component 1`] = `
<div>
<button>
<span
class="flex flex-col gap-2 items-center justify-center text-gray-500 hover:text-sky transition-all duration-300 cursor-pointer"
>
<span>
<svg
fill="currentColor"
height="20"
stroke="currentColor"
stroke-width="0"
viewBox="0 0 1024 1024"
width="20"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M1016.7 513.36L536.331 10.192a31.924 31.924 0 0 0-23.088-9.84 32.038 32.038 0 0 0-23.088 9.84L7.307 513.344c-12.24 12.752-11.808 32.992.944 45.248 12.752 12.224 32.992 11.872 45.248-.944l43.007-44.832v478.832c0 17.68 14.336 32 32 32h223.552c17.632 0 31.936-14.256 32-31.905l1.008-319.664h254.992v319.568c0 17.68 14.32 32 32 32H895.53c17.68 0 32-14.32 32-32V512.655l42.992 45.04a31.997 31.997 0 0 0 23.09 9.84c7.967 0 15.967-2.944 22.16-8.944 12.736-12.224 13.152-32.48.928-45.232zm-153.165-58.544v504.831H704.063V640.095c0-17.68-14.32-32-32-32h-318.88c-17.632 0-31.936 14.256-32 31.904l-1.008 319.664H160.511V454.815c0-2.64-.416-5.168-1.008-7.632L513.263 78.56l351.424 368.208c-.688 2.592-1.152 5.264-1.152 8.048z"
/>
</svg>
</span>
<h6
class="text-xs"
>
Accueil
</h6>
</span>
</button>
</div>
`;

1 comment on commit bb55e60

@vercel
Copy link

@vercel vercel bot commented on bb55e60 Oct 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wii-qare-fe – ./

wii-qare-fe-wiiqare.vercel.app
wii-qare-fe.vercel.app
wii-qare-fe-git-main-wiiqare.vercel.app

Please sign in to comment.