@@ -0,0 +1,8 @@
+import { renderMarkdown } from './markdown';
+
+describe('Markdown wrapper', () => {
+ it('should be able to handle undefined value', () => {
+ const str = renderMarkdown(undefined);
+ expect(str).toBe('');
+ });
+});
@@ -15,6 +15,6 @@ export function setMarkdownOptions(optionsOverride?: MarkedOptions) {
marked.setOptions({ ...defaultMarkedOptions, ...optionsOverride });
}
-export function renderMarkdown(str: string): string {
- return marked(str);
+export function renderMarkdown(str?: string): string {
+ return marked(str || '');