diff --git a/src/screens/OrganizationTags/OrganizationTags.test.tsx b/src/screens/OrganizationTags/OrganizationTags.spec.tsx similarity index 96% rename from src/screens/OrganizationTags/OrganizationTags.test.tsx rename to src/screens/OrganizationTags/OrganizationTags.spec.tsx index 0d426d20ac..c35b69f631 100644 --- a/src/screens/OrganizationTags/OrganizationTags.test.tsx +++ b/src/screens/OrganizationTags/OrganizationTags.spec.tsx @@ -11,7 +11,7 @@ import { waitForElementToBeRemoved, } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import 'jest-location-mock'; +import { vi } from 'vitest'; import { I18nextProvider } from 'react-i18next'; import { Provider } from 'react-redux'; import { MemoryRouter, Route, Routes } from 'react-router-dom'; @@ -44,10 +44,10 @@ async function wait(ms = 500): Promise { }); } -jest.mock('react-toastify', () => ({ +vi.mock('react-toastify', () => ({ toast: { - success: jest.fn(), - error: jest.fn(), + success: vi.fn(), + error: vi.fn(), }, })); @@ -77,14 +77,17 @@ const renderOrganizationTags = (link: ApolloLink): RenderResult => { describe('Organisation Tags Page', () => { beforeEach(() => { - jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), - useParams: () => ({ orgId: 'orgId' }), - })); + vi.mock('react-router-dom', async () => { + const actual = await vi.importActual('react-router-dom'); + return { + ...actual, + useParams: () => ({ orgId: 'orgId' }), + }; + }); }); afterEach(() => { - jest.clearAllMocks(); + vi.clearAllMocks(); cleanup(); }); @@ -129,7 +132,6 @@ describe('Organisation Tags Page', () => { screen.queryByTestId('closeCreateTagModal'), ); }); - test('navigates to sub tags screen after clicking on a tag', async () => { renderOrganizationTags(link); diff --git a/src/screens/OrganizationTags/OrganizationTagsMocks.ts b/src/screens/OrganizationTags/OrganizationTagsMocks.ts index 0fe48ca97f..7fa6a4ef0e 100644 --- a/src/screens/OrganizationTags/OrganizationTagsMocks.ts +++ b/src/screens/OrganizationTags/OrganizationTagsMocks.ts @@ -7,7 +7,7 @@ export const MOCKS = [ request: { query: ORGANIZATION_USER_TAGS_LIST, variables: { - id: '123', + id: 'orgId', first: TAGS_QUERY_DATA_CHUNK_SIZE, where: { name: { starts_with: '' } }, sortedBy: { id: 'DESCENDING' }, @@ -187,7 +187,7 @@ export const MOCKS = [ request: { query: ORGANIZATION_USER_TAGS_LIST, variables: { - id: '123', + id: 'orgId', first: TAGS_QUERY_DATA_CHUNK_SIZE, after: '10', where: { name: { starts_with: '' } }, @@ -248,7 +248,7 @@ export const MOCKS = [ request: { query: ORGANIZATION_USER_TAGS_LIST, variables: { - id: '123', + id: 'orgId', first: TAGS_QUERY_DATA_CHUNK_SIZE, where: { name: { starts_with: 'searchUserTag' } }, sortedBy: { id: 'DESCENDING' }, @@ -322,7 +322,7 @@ export const MOCKS = [ request: { query: ORGANIZATION_USER_TAGS_LIST, variables: { - id: '123', + id: 'orgId', first: TAGS_QUERY_DATA_CHUNK_SIZE, where: { name: { starts_with: 'searchUserTag' } }, sortedBy: { id: 'ASCENDING' }, @@ -397,7 +397,7 @@ export const MOCKS = [ query: CREATE_USER_TAG, variables: { name: 'userTag 12', - organizationId: '123', + organizationId: 'orgId', }, }, result: { @@ -415,7 +415,7 @@ export const MOCKS_ERROR = [ request: { query: ORGANIZATION_USER_TAGS_LIST, variables: { - id: '123', + id: 'orgId', first: TAGS_QUERY_DATA_CHUNK_SIZE, where: { name: { starts_with: '' } }, sortedBy: { id: 'DESCENDING' },