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

Refactored src/components/GroupChatDetails from jest to vitest #3453

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import React from 'react';
import {
render,
screen,
// fireEvent,
// waitFor,
act,
fireEvent,
waitFor,
Expand All @@ -18,6 +16,7 @@ import { USERS_CONNECTION_LIST } from 'GraphQl/Queries/Queries';
import { I18nextProvider, initReactI18next } from 'react-i18next';
import i18n from 'i18next';
import { useLocalStorage } from 'utils/useLocalstorage';
import { vi } from 'vitest';

const { setItem } = useLocalStorage();

Expand Down Expand Up @@ -432,10 +431,10 @@ describe('GroupChatDetails', () => {
<I18nextProvider i18n={i18n}>
<MockedProvider mocks={mocks} addTypename={false}>
<GroupChatDetails
toggleGroupChatDetailsModal={jest.fn()}
toggleGroupChatDetailsModal={vi.fn()}
groupChatDetailsModalisOpen={true}
chat={chat}
chatRefetch={jest.fn()}
chatRefetch={vi.fn()}
/>
</MockedProvider>
</I18nextProvider>,
Expand All @@ -456,10 +455,10 @@ describe('GroupChatDetails', () => {
<I18nextProvider i18n={i18n}>
<MockedProvider mocks={mocks} addTypename={false}>
<GroupChatDetails
toggleGroupChatDetailsModal={jest.fn()}
toggleGroupChatDetailsModal={vi.fn()}
groupChatDetailsModalisOpen={true}
chat={mockChat}
chatRefetch={jest.fn()}
chatRefetch={vi.fn()}
/>
</MockedProvider>
</I18nextProvider>,
Expand Down Expand Up @@ -518,10 +517,10 @@ describe('GroupChatDetails', () => {
<I18nextProvider i18n={i18n}>
<MockedProvider mocks={mocks} addTypename={false}>
<GroupChatDetails
toggleGroupChatDetailsModal={jest.fn()}
toggleGroupChatDetailsModal={vi.fn()}
groupChatDetailsModalisOpen={true}
chat={mockChat}
chatRefetch={jest.fn()}
chatRefetch={vi.fn()}
/>
</MockedProvider>
</I18nextProvider>,
Expand Down Expand Up @@ -558,19 +557,17 @@ describe('GroupChatDetails', () => {
await act(async () => {
fireEvent.click(await screen.findByTestId('addUserBtn'));
});

await wait(10000);
});
// test case for updating group chat image
it('update group chat image', async () => {
render(
<I18nextProvider i18n={i18n}>
<MockedProvider mocks={mocks} addTypename={false}>
<GroupChatDetails
toggleGroupChatDetailsModal={jest.fn()}
toggleGroupChatDetailsModal={vi.fn()}
groupChatDetailsModalisOpen={true}
chat={mockChat}
chatRefetch={jest.fn()}
chatRefetch={vi.fn()}
/>
</MockedProvider>
</I18nextProvider>,
Expand All @@ -597,7 +594,5 @@ describe('GroupChatDetails', () => {
});

fireEvent.change(fileInput);

await wait(10000);
});
});
Loading