Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

node tests: Refactor muting test in message_list.

Abhijeet Prasad Bodase8b4902c8ae7
diff --git a/frontend_tests/node_tests/message_list.js b/frontend_tests/node_tests/message_list.js
index 6231f9e58c0..c701e3b4d91 100644
--- a/frontend_tests/node_tests/message_list.js
+++ b/frontend_tests/node_tests/message_list.js
@@ -363,21 +363,20 @@ run_test("bookend", (override) => {
});
});
-run_test("unmuted_messages", (override) => {
+run_test("filter_muted_topic_messages", () => {
const list = new MessageList({});
-
- const muted_stream_id = 999;
+ muting.add_muted_topic(1, "muted");
const unmuted = [
{
id: 50,
- stream_id: muted_stream_id,
+ stream_id: 1,
mentioned: true, // overrides mute
- topic: "whatever",
+ topic: "muted",
},
{
id: 60,
- stream_id: 42,
+ stream_id: 1,
mentioned: false,
topic: "whatever",
},
@@ -385,14 +384,12 @@ run_test("unmuted_messages", (override) => {
const muted = [
{
id: 70,
- stream_id: muted_stream_id,
+ stream_id: 1,
mentioned: false,
- topic: "whatever",
+ topic: "muted",
},
];
- override("muting.is_topic_muted", (stream_id) => stream_id === muted_stream_id);
-
// Make sure unmuted_message filters out the "muted" entry,
// which we mark as having a muted topic, and not mentioned.
const test_unmuted = list.unmuted_messages(unmuted.concat(muted));