Skip to content

Commit

Permalink
Migrate to vitest (#2947)
Browse files Browse the repository at this point in the history
* Migrated LeftDrawerOrg.test.tsx from jest to vitest

* Original Configuration of vitest.config file
  • Loading branch information
gracefullcoder authored Dec 26, 2024
1 parent 167a846 commit 5b3e840
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@testing-library/jest-dom';
import React, { act } from 'react';
import { fireEvent, render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import 'jest-localstorage-mock';
import { I18nextProvider } from 'react-i18next';
import { BrowserRouter, MemoryRouter } from 'react-router-dom';

Expand All @@ -15,6 +15,7 @@ import { ORGANIZATIONS_LIST } from 'GraphQl/Queries/Queries';
import { StaticMockLink } from 'utils/StaticMockLink';
import { REVOKE_REFRESH_TOKEN } from 'GraphQl/Mutations/mutations';
import useLocalStorage from 'utils/useLocalstorage';
import { vi, describe, test, expect } from 'vitest';

const { setItem } = useLocalStorage();

Expand Down Expand Up @@ -65,7 +66,7 @@ const props: InterfaceLeftDrawerProps = {
},
],
hideDrawer: false,
setHideDrawer: jest.fn(),
setHideDrawer: vi.fn(),
};

const MOCKS = [
Expand Down Expand Up @@ -244,11 +245,11 @@ const defaultScreens = [
'All Organizations',
];

jest.mock('react-toastify', () => ({
vi.mock('react-toastify', () => ({
toast: {
success: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
success: vi.fn(),
warn: vi.fn(),
error: vi.fn(),
},
}));

Expand All @@ -275,7 +276,7 @@ beforeEach(() => {
});

afterEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
localStorage.clear();
});

Expand Down

0 comments on commit 5b3e840

Please sign in to comment.