diff --git a/src/MarkdownDescription/MarkdownDescription.test.tsx b/src/MarkdownDescription/MarkdownDescription.test.tsx
new file mode 100644
index 0000000..b3edf7b
--- /dev/null
+++ b/src/MarkdownDescription/MarkdownDescription.test.tsx
@@ -0,0 +1,36 @@
+import React from "react";
+import ReactDOM from "react-dom";
+import MarkdownDescription from "./MarkdownDescription";
+
+it("renders without crashing", () => {
+ const div = document.createElement("div");
+ ReactDOM.render(, div);
+ ReactDOM.unmountComponentAtNode(div);
+});
+
+it("renders a description", () => {
+ const div = document.createElement("div");
+ ReactDOM.render(, div);
+ expect(div.innerHTML).toContain("foo");
+ ReactDOM.unmountComponentAtNode(div);
+});
+
+it("renders a description with syntax highlighting", () => {
+ const div = document.createElement("div");
+ ReactDOM.render(, div);
+ expect(div.innerHTML).toContain("language-javascript");
+ ReactDOM.unmountComponentAtNode(div);
+});
+
+it("renders a description with darkmode syntax highlighting", () => {
+ const div = document.createElement("div");
+ ReactDOM.render(, div);
+ expect(div.innerHTML).toContain("language-javascript");
+ ReactDOM.unmountComponentAtNode(div);
+});
+
+it("renders a description that errors", () => {
+ const div = document.createElement("div");
+ ReactDOM.render(, div);
+ ReactDOM.unmountComponentAtNode(div);
+});
diff --git a/src/MarkdownDescription/MarkdownDescription.tsx b/src/MarkdownDescription/MarkdownDescription.tsx
index dbc00f0..ce8f152 100644
--- a/src/MarkdownDescription/MarkdownDescription.tsx
+++ b/src/MarkdownDescription/MarkdownDescription.tsx
@@ -2,7 +2,6 @@ import React from "react";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { materialDark, materialLight } from "react-syntax-highlighter/dist/cjs/styles/prism";
import ReactMarkdown from "react-markdown";
-import { Container } from "@material-ui/core";
interface IProps {
className?: string;
@@ -11,25 +10,24 @@ interface IProps {
}
const MarkdownDescription: React.FC = ({ source, className, uiSchema }) => {
- try {
- return (
- {
- return ;
- },
- }}
- source={source}
- className={className}
- />
- );
- } catch (e) {
- return ;
- }
+ return (
+ {
+ if (!value) {
+ return
;
+ }
+ return ;
+ },
+ }}
+ source={source}
+ className={className}
+ />
+ );
};
export default MarkdownDescription;