Skip to content

Commit

Permalink
PalisadoesFoundation#2970: autoGen-talawa-admin-docs-debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
bint-Eve committed Jan 10, 2025
1 parent 0be6b3c commit 7b34f2f
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions src/screens/OrganizationVenues/OrganizationVenues.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ import { vi } from 'vitest';
import { errorHandler } from 'utils/errorHandler';

// Mock MutationObserver
import type {
MutationCallback,
MutationObserver,
MutationRecord,
} from '@types/node';

if (typeof global.MutationObserver !== 'function') {
global.MutationObserver = class MutationObserver {
constructor(callback: MutationCallback) {
this.callback = callback;
}
observe(target: Node, options?: MutationObserverInit) {}
disconnect() {}
takeRecords(): MutationRecord[] {
return [];
}
private callback: MutationCallback;
};
class MockMutationObserver {
private callback: (mutations: any[], observer: any) => void;

constructor(callback: (mutations: any[], observer: any) => void) {
this.callback = callback;
}

observe(): void {
// Mock implementation
}

disconnect(): void {
// Mock implementation
}

takeRecords(): any[] {
return [];
}
}

const MOCKS = [
Expand Down Expand Up @@ -281,6 +281,15 @@ vi.mock('react-toastify', () => ({
},
}));

beforeAll(() => {
global.MutationObserver =
MockMutationObserver as unknown as typeof MutationObserver;
});

afterAll(() => {
vi.restoreAllMocks();
});

const renderOrganizationVenue = (link: ApolloLink): RenderResult => {
return render(
<MockedProvider addTypename={false} link={link}>
Expand Down

0 comments on commit 7b34f2f

Please sign in to comment.