Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
node tests: Extract markdown_katex.
Steve Howellc50dbf82974c
diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.jsindex 254975057aa..47862bbfcba 100644--- a/frontend_tests/node_tests/markdown.js+++ b/frontend_tests/node_tests/markdown.js@@ -697,15 +697,6 @@ run_test("python_to_js_filter", () => {assert.deepEqual(actual_value, expected_value);});-run_test("katex_throws_unexpected_exceptions", () => {- katex.renderToString = function () {- throw new Error("some-exception");- };- blueslip.expect("error", "Error: some-exception");- const message = {raw_content: "$$a$$"};- markdown.apply_markdown(message);-});-run_test("translate_emoticons_to_names", () => {// Simple testconst test_text = "Testing :)";diff --git a/frontend_tests/node_tests/markdown_katex.js b/frontend_tests/node_tests/markdown_katex.jsnew file mode 100644index 00000000000..23cd3646621--- /dev/null+++ b/frontend_tests/node_tests/markdown_katex.js@@ -0,0 +1,35 @@+/*+ This whole module is dedicated to adding+ one line of coverage for markdown.js.++ There may be a better way.+*/++const markdown_config = zrequire("markdown_config");++set_global("marked", zrequire("marked", "third/marked/lib/marked"));+set_global("page_params", {});++zrequire("emoji");+zrequire("fenced_code");+zrequire("hash_util");+zrequire("message_store");+zrequire("people");+zrequire("stream_data");+zrequire("user_groups");++set_global("katex", {+ renderToString: () => {+ throw new Error("some-exception");+ },+});++const markdown = zrequire("markdown");++markdown.initialize([], markdown_config.get_helpers());++run_test("katex_throws_unexpected_exceptions", () => {+ blueslip.expect("error", "Error: some-exception");+ const message = {raw_content: "$$a$$"};+ markdown.apply_markdown(message);+});