const formatters = require('../url_to_markdown_formatters.js'); const test_html_table = ""+ ""+ ""+ "
OneTwo
12
"; const expected_markdown_table = "\n|One|Two|\n|---|---|\n|1 |2 |\n"; test('format table', () => { let replacements = []; formatters.format_tables(test_html_table, replacements); let output_markdown_table = replacements[0].replacement; expect(output_markdown_table).toBe(expected_markdown_table); }); const test_html_codeblock = "
" +
	"#include <stdio.h>\n" +
	"int main() {\n" +
	"\tprintf(\"hello world\");\n" +
	"}" +
	"
"; const expected_markdown_codeblock = "```\n#include \nint main() {\n\tprintf(\"hello world\");\n}\n```\n"; test('format code block', () => { let replacements = []; formatters.format_codeblocks(test_html_codeblock, replacements); let output_markdown_codeblock = replacements[0].replacement; expect(output_markdown_codeblock).toBe(expected_markdown_codeblock); })