Skip to content

Commit

Permalink
Changed the OrgContribution from jest to vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshat authored and Akshat committed Dec 11, 2024
1 parent 0630cff commit 90c5ad8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* Unit tests for the AddOn component.
*
* This file contains tests for the OrgContribution to ensure it behaves as expected
* under various scenarios.
*/
import React, { act } from 'react';
import { MockedProvider } from '@apollo/react-testing';
import { render } from '@testing-library/react';
Expand All @@ -7,6 +13,8 @@ import 'jest-location-mock';
import { I18nextProvider } from 'react-i18next';

import OrgContribution from './OrgContribution';
import '@testing-library/jest-dom';
import { describe, test, expect, vi } from 'vitest';
import { store } from 'state/store';
import i18nForTest from 'utils/i18nForTest';
import { StaticMockLink } from 'utils/StaticMockLink';
Expand All @@ -18,6 +26,21 @@ async function wait(ms = 100): Promise<void> {
});
});
}
vi.mock('state/store', () => ({
store: {
// Mock store configuration if needed
getState: vi.fn(),
subscribe: vi.fn(),
dispatch: vi.fn(),
},
}));

vi.mock('utils/i18nForTest', () => ({
__esModule: true,
default: vi.fn(() => ({
t: (key: string) => key,
})),
}));

describe('Organisation Contribution Page', () => {
test('should render props and text elements test for the screen', async () => {
Expand Down
4 changes: 2 additions & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export default defineConfig({
tsconfigPaths(),
],
test: {
include: ['src/**/*.spec.{js,jsx,ts,tsx}'],
include: ['src/**/*.{spec,test}.{js,jsx,ts,tsx}'],
globals: true,
environment: 'jsdom',
setupFiles: 'vitest.setup.ts',
setupFiles: ['src/test/setup.ts'],
coverage: {
enabled: true,
provider: 'istanbul',
Expand Down

0 comments on commit 90c5ad8

Please sign in to comment.