sodenn / lexical-beautiful-mentions

A mentions plugin for the lexical text editor.
https://lexical-beautiful-mentions-docs.vercel.app/
MIT License
164 stars 26 forks source link

react testing liberary test case failing. #579

Open saif-webonise opened 2 months ago

saif-webonise commented 2 months ago

Describe the bug while writing test cases lexical-beautiful-mentions throw below error. 1- got error in zeroWidthPlugin

2- q.getType is not a function

please provide us the solution how to mock lexical-beautiful-mentions

jest.mock('lexical-beautiful-mentions', () => ({ BeautifulMentionNode: () => ({ trigger: '', value: '', __data: {}, createDOM: jest.fn(), updateDOM: jest.fn(), exportDOM: jest.fn(), exportJSON: jest.fn(), getTextContent: jest.fn(), getTrigger: jest.fn(), getValue: jest.fn(), setValue: jest.fn(), getData: jest.fn(), setData: jest.fn(), component: jest.fn(), decorate: jest.fn(), getType: jest.fn(), getCssClassesFromTheme: jest.fn(), }), matchMedia: true, BeautifulMentionsItem: jest.fn(), useBeautifulMentions: () => ({ insertMention: jest.fn(), }), ZeroWidthPlugin: jest.fn(), }));

github-actions[bot] commented 3 days ago

This issue is stale because it has been open for 60 days with no activity.