diff --git a/src/core/components/providers/markdown.jsx b/src/core/components/providers/markdown.jsx index d058d17617feeb17fe68b25f0e766df979eea9aa..8ebce12c0c0e5a4c8a6039592d0531c94309b6ca 100644 --- a/src/core/components/providers/markdown.jsx +++ b/src/core/components/providers/markdown.jsx @@ -11,6 +11,12 @@ const sanitizeOptions = { function Markdown({ source }) { const sanitized = sanitize(source, sanitizeOptions) + + // sometimes the sanitizer returns "undefined" as a string + if(!source || !sanitized || sanitized === "undefined") { + return null + } + return ) + + expect(el.text()).toEqual("") + }) + + it("should return no text for `undefined` as source input", function(){ + let props = { + source: undefined + } + + let el = render() + + expect(el.text()).toEqual("") + }) + + it("should return no text for empty string as source input", function(){ + let props = { + source: "" + } + + let el = render() + + expect(el.text()).toEqual("") + }) +})