Skip to content

Commit

Permalink
Merge branch 'develop-postgres' into issue#2827
Browse files Browse the repository at this point in the history
  • Loading branch information
aadhil2k4 authored Dec 26, 2024
2 parents ad6d05a + 9772f7d commit 7631a65
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import availableFieldTypes from 'utils/fieldTypes';
import { I18nextProvider } from 'react-i18next';
import i18nForTest from 'utils/i18nForTest';
import type { InterfaceCustomFieldData } from 'utils/interfaces';
import { describe, it, expect } from 'vitest';

async function wait(ms = 100): Promise<void> {
await act(() => {
Expand All @@ -18,19 +19,18 @@ async function wait(ms = 100): Promise<void> {
}

describe('Testing Custom Field Dropdown', () => {
test('Component Should be rendered properly', async () => {
it('Component Should be rendered properly', async () => {
const customFieldData = {
type: 'Number',
name: 'Age',
};

const setCustomFieldData: Dispatch<
SetStateAction<InterfaceCustomFieldData>
> = (val) => {
{
val;
}
> = () => {
// Intentionally left blank for testing purposes
};

const props = {
customFieldData: customFieldData as InterfaceCustomFieldData,
setCustomFieldData: setCustomFieldData,
Expand Down
10 changes: 3 additions & 7 deletions src/screens/OrganizationDashboard/OrganizationDashboard.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('Testing Organization Dashboard Screen', () => {
vi.mocked(useParams).mockReturnValue({ orgId: 'orgId' });
renderOrganizationDashboard(link1);

// Wait for initial load
// First wait for the dashboard to fully load
await waitFor(() => {
expect(screen.getByText(t.upcomingEvents)).toBeInTheDocument();
});
Expand All @@ -160,12 +160,8 @@ describe('Testing Organization Dashboard Screen', () => {
expect(screen.getByText(t.events)).toBeInTheDocument();
expect(screen.getByText(t.blockedUsers)).toBeInTheDocument();

// Upcoming events - Using more flexible matcher
await waitFor(() => {
expect(
screen.getByText(/Event 1/i, { exact: false }),
).toBeInTheDocument();
});
// Upcoming events - Use a more flexible matcher
expect(screen.getByText(/Event 1/i, { exact: false })).toBeInTheDocument();

// Latest posts
expect(screen.getByText(t.latestPosts)).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ type TFunction = (key: string, options?: Record<string, unknown>) => string;

import { errorHandler } from './errorHandler';
import { toast } from 'react-toastify';
import { describe, it, expect, vi } from 'vitest';

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

Expand All @@ -22,7 +23,7 @@ describe('Test if errorHandler is working properly', () => {
};

beforeEach(() => {
jest.clearAllMocks();
vi.clearAllMocks();
});

it('should call toast.error with the correct message if error message is "Failed to fetch"', async () => {
Expand Down

0 comments on commit 7631a65

Please sign in to comment.