Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
node_tests: Fix ineffective rewiremocks installed after import.
Anders Kaseorg4b1b1950b27b
diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.jsindex bd7c24b3b30..1012c389b53 100644--- a/frontend_tests/node_tests/compose_actions.js+++ b/frontend_tests/node_tests/compose_actions.js@@ -371,11 +371,9 @@ run_test("quote_and_reply", (override) => {raw_content: "Testing.",};- rewiremock("../../static/js/channel").with({- get() {- assert.fail("channel.get should not be used if raw_content is present");- },- });+ channel.get = () => {+ assert.fail("channel.get should not be used if raw_content is present");+ };replaced = false;quote_and_reply(opts);diff --git a/frontend_tests/node_tests/stream_topic_history.js b/frontend_tests/node_tests/stream_topic_history.jsindex 4460e8430d4..7c75ea4a27c 100644--- a/frontend_tests/node_tests/stream_topic_history.js+++ b/frontend_tests/node_tests/stream_topic_history.js@@ -10,6 +10,8 @@ const {run_test} = require("../zjsunit/test");const channel = {__esModule: true};rewiremock("../../static/js/channel").with(channel);const message_list = set_global("message_list", {});+const message_util = {__esModule: true};+rewiremock("../../static/js/message_util").with(message_util);rewiremock.enable();@@ -61,10 +63,8 @@ run_test("basics", () => {assert.deepEqual(history, ["Topic1", "topic2"]);assert.deepEqual(max_message_id, 104);- rewiremock("../../static/js/message_util").with({- get_messages_in_topic: () => [{id: 101}, {id: 102}],- get_max_message_id_in_stream: () => 103,- });+ message_util.get_messages_in_topic = () => [{id: 101}, {id: 102}];+ message_util.get_max_message_id_in_stream = () => 103;// Removing the last msg in topic1 changes the orderstream_topic_history.remove_messages({stream_id,@@ -78,10 +78,7 @@ run_test("basics", () => {max_message_id = stream_topic_history.get_max_message_id(stream_id);assert.deepEqual(max_message_id, 103);- rewiremock("../../static/js/message_util").with({- get_messages_in_topic: () => [{id: 102}],- get_max_message_id_in_stream: () => 103,- });+ message_util.get_messages_in_topic = () => [{id: 102}];// Removing first topic1 message has no effect.stream_topic_history.remove_messages({stream_id,