Skip to content

Commit 26b3cd7

Browse files
committed
Mock react-markdown to fix jest issue
1 parent 5dd4d3a commit 26b3cd7

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
},
55
moduleNameMapper: {
66
'\\.svg$': '<rootDir>/src/tests/__mocks__/svg.ts',
7+
"^react-markdown$": "<rootDir>/src/__mocks__/react-markdown.tsx",
78
},
89
collectCoverageFrom: [
910
"src/**/*.{js,jsx,ts,tsx}",

src/__mocks__/react-markdown.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react';
2+
3+
interface ReactMarkdownProps {
4+
children: string;
5+
[key: string]: any;
6+
}
7+
8+
const ReactMarkdown: React.FC<ReactMarkdownProps> = ({ children }) => {
9+
return <div data-testid="react-markdown">{children}</div>;
10+
};
11+
12+
export default ReactMarkdown;

0 commit comments

Comments
 (0)