fix failing unit test of block editor in main (#20214)

This commit is contained in:
Shailesh Parmar 2025-03-12 20:42:04 +05:30 committed by GitHub
parent f6aa883605
commit e76e285cd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 2 deletions

View File

@ -13,7 +13,6 @@
import { EditorOptions } from '@tiptap/core';
import { Editor } from '@tiptap/react';
import { DependencyList, useEffect, useRef, useState } from 'react';
import { extensions } from '../Extensions';
function useForceUpdate() {
const [, setValue] = useState(0);
@ -120,7 +119,6 @@ export const useCustomEditor = (
const instance = new Editor({
...options,
extensions: [...extensions],
});
setEditor(instance);

View File

@ -26,6 +26,9 @@ jest.mock('../../common/NextPrevious/NextPrevious', () => {
</div>
));
});
jest.mock('../../common/RichTextEditor/RichTextEditorPreviewerV1', () =>
jest.fn().mockImplementation(({ markdown }) => <div>{markdown}</div>)
);
const mockChildrenList = [
{

View File

@ -41,6 +41,10 @@ jest.mock('react-router-dom', () => ({
})),
}));
jest.mock('../../../common/RichTextEditor/RichTextEditorPreviewerV1', () =>
jest.fn().mockImplementation(({ markdown }) => <div>{markdown}</div>)
);
describe('PersonaDetailsCard Component', () => {
it('should render persona details card', async () => {
await act(async () => {

View File

@ -23,6 +23,10 @@ const props = {
showDescription: true,
};
jest.mock('../../../common/RichTextEditor/RichTextEditorPreviewerV1', () =>
jest.fn().mockImplementation(({ markdown }) => <div>{markdown}</div>)
);
describe('ApplicationCard', () => {
beforeEach(() => {
jest.useFakeTimers();

View File

@ -40,6 +40,10 @@ jest.mock('../SuggestionsProvider/SuggestionsProvider', () => ({
default: 'SuggestionsProvider',
}));
jest.mock('../../common/RichTextEditor/RichTextEditorPreviewerV1', () =>
jest.fn().mockImplementation(({ markdown }) => <div>{markdown}</div>)
);
describe('SuggestionsAlert', () => {
beforeEach(() => {
jest.useFakeTimers();