import { runtime } from './convertHtmlToMarkdown'; import { CommandContext } from '../services/CommandService'; import { defaultState } from '../reducer'; const command = runtime(); const makeContext = (): CommandContext => { return { state: defaultState, dispatch: ()=>{}, }; }; describe('convertHtmlToMarkdown', () => { it.each([ ['test', '**test**'], ['Joplin', '[Joplin](https://joplin.org)'], ['

Title

\n

Subtitle

', '# Title\n\n## Subtitle'], ['', '- One\n- Two'], ['

First paragraph

This is the second paragraph

', 'First paragraph\n\nThis is the second paragraph'], ['

A paragraph with bold and italic

', 'A paragraph with **bold** and *italic*'], ])('should turn HTML into Markdown', async (html, markdown) => { const context = makeContext(); const result: string = await command.execute(context, html); expect(result).toBe(markdown); }); });