Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tests: Use typed helpers in markdown.test.cjs.
Tim Abbottb267beea5213
diff --git a/web/tests/markdown.test.cjs b/web/tests/markdown.test.cjsindex 814def9be8f..3fd1ce95f22 100644--- a/web/tests/markdown.test.cjs+++ b/web/tests/markdown.test.cjs@@ -6,7 +6,10 @@ const katex = require("katex");const markdown_test_cases = require("../../zerver/tests/fixtures/markdown_test_cases.json");+const {make_user_group} = require("./lib/example_group.cjs");const {make_realm} = require("./lib/example_realm.cjs");+const {make_stream} = require("./lib/example_stream.cjs");+const {make_user} = require("./lib/example_user.cjs");const markdown_assert = require("./lib/markdown_assert.cjs");const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");const {run_test} = require("./lib/test.cjs");@@ -84,128 +87,142 @@ const emoji_params = {emoji.initialize(emoji_params);fenced_code.initialize(pygments_data);-const cordelia = {+const cordelia = make_user({full_name: "Cordelia, Lear's daughter",user_id: 101,email: "[email protected]",-};-people.add_active_user(cordelia);--people.add_active_user({- full_name: "Leo",- user_id: 102,- email: "[email protected]",-});--people.add_active_user({- full_name: "Bobby <h1>Tables</h1>",- user_id: 103,- email: "[email protected]",-});--people.add_active_user({- full_name: "Mark Twin",- user_id: 104,- email: "[email protected]",-});--people.add_active_user({- full_name: "Mark Twin",- user_id: 105,- email: "[email protected]",-});--people.add_active_user({- full_name: "Brother of Bobby|123",- user_id: 106,- email: "[email protected]",-});--people.add_active_user({- full_name: "& & &",- user_id: 107,- email: "[email protected]",});+people.add_active_user(cordelia);-people.add_active_user({- full_name: "Zoe",- user_id: 7,- email: "[email protected]",-});+people.add_active_user(+ make_user({+ full_name: "Leo",+ user_id: 102,+ email: "[email protected]",+ }),+);++people.add_active_user(+ make_user({+ full_name: "Bobby <h1>Tables</h1>",+ user_id: 103,+ email: "[email protected]",+ }),+);++people.add_active_user(+ make_user({+ full_name: "Mark Twin",+ user_id: 104,+ email: "[email protected]",+ }),+);++people.add_active_user(+ make_user({+ full_name: "Mark Twin",+ user_id: 105,+ email: "[email protected]",+ }),+);++people.add_active_user(+ make_user({+ full_name: "Brother of Bobby|123",+ user_id: 106,+ email: "[email protected]",+ }),+);++people.add_active_user(+ make_user({+ full_name: "& & &",+ user_id: 107,+ email: "[email protected]",+ }),+);++people.add_active_user(+ make_user({+ full_name: "Zoe",+ user_id: 7,+ email: "[email protected]",+ }),+);people.add_inaccessible_user(108);people.initialize_current_user(cordelia.user_id);-const hamletcharacters = {+const hamletcharacters = make_user_group({name: "hamletcharacters",id: 1,description: "Characters of Hamlet",members: [cordelia.user_id],-};+});-const backend = {+const backend = make_user_group({name: "Backend",id: 2,description: "Backend team",members: [],-};+});-const edgecase_group = {+const edgecase_group = make_user_group({name: "Bobby <h1>Tables</h1>",id: 3,description: "HTML syntax to check for Markdown edge cases.",members: [],-};+});-const amp_group = {+const amp_group = make_user_group({name: "& & &",id: 4,description: "Check ampersand escaping",members: [],-};+});user_groups.add(hamletcharacters);user_groups.add(backend);user_groups.add(edgecase_group);user_groups.add(amp_group);-const denmark = {+const denmark = make_stream({subscribed: false,color: "blue",name: "Denmark",stream_id: 1,is_muted: true,-};-const social = {+});+const social = make_stream({subscribed: true,color: "red",name: "social",stream_id: 2,is_muted: false,invite_only: true,-};-const edgecase_stream = {+});+const edgecase_stream = make_stream({subscribed: true,color: "green",name: "Bobby <h1>Tables</h1>",stream_id: 3,is_muted: false,-};-const edgecase_stream_2 = {+});+const edgecase_stream_2 = make_stream({subscribed: true,color: "yellow",name: "Bobby <h1",stream_id: 4,is_muted: false,-};-const amp_stream = {+});+const amp_stream = make_stream({subscribed: true,color: "orange",name: "& & &",stream_id: 5,is_muted: false,-};+});stream_data.add_sub_for_tests(denmark);stream_data.add_sub_for_tests(social);stream_data.add_sub_for_tests(edgecase_stream);