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: Remove mock of `topic_list` in `topic_list_data.test`.

Lauryn Menardb9023db04e68
diff --git a/web/tests/topic_list_data.test.js b/web/tests/topic_list_data.test.js
index 6f9e34c9966..cf02f306571 100644
--- a/web/tests/topic_list_data.test.js
+++ b/web/tests/topic_list_data.test.js
@@ -24,10 +24,6 @@ const narrow_state = mock_esm("../src/narrow_state", {
topic() {},
});
-const topic_list = mock_esm("../src/topic_list", {
- get_topic_search_term() {},
-});
-
const stream_data = zrequire("stream_data");
const stream_topic_history = zrequire("stream_topic_history");
const topic_list_data = zrequire("topic_list_data");
@@ -40,9 +36,11 @@ const general = {
stream_data.add_sub(general);
-function get_list_info(zoomed) {
+function get_list_info(zoom, search) {
const stream_id = general.stream_id;
- return topic_list_data.get_list_info(stream_id, zoomed, topic_list.get_topic_search_term());
+ const zoomed = zoom === undefined ? false : zoom;
+ const search_term = search === undefined ? "" : search;
+ return topic_list_data.get_list_info(stream_id, zoomed, search_term);
}
function test(label, f) {
@@ -112,11 +110,10 @@ test("get_list_info w/real stream_topic_history", ({override}) => {
unread: 0,
url: "#narrow/stream/556-general/topic/topic.208",
});
- // If we zoom in, our results based on topic filter.
- // If topic search input is empty, we show all 10 topics.
+ // If we zoom in, our results are based on topic filter.
+ // If topic search input is empty, we show all 10 topics.
const zoomed = true;
- override(topic_list, "get_topic_search_term", () => "");
list_info = get_list_info(zoomed);
assert.equal(list_info.items.length, 10);
assert.equal(list_info.more_topics_unreads, 0);
@@ -125,9 +122,11 @@ test("get_list_info w/real stream_topic_history", ({override}) => {
add_topic_message("After Brooklyn", 1008);
add_topic_message("Catering", 1009);
- // when topic search is open then we list topics based on search term.
- override(topic_list, "get_topic_search_term", () => "b,c");
- list_info = get_list_info(zoomed);
+
+ // When topic search input is not empty, we show topics
+ // based on the search term.
+ const search_term = "b,c";
+ list_info = get_list_info(zoomed, search_term);
assert.equal(list_info.items.length, 2);
assert.equal(list_info.more_topics_unreads, 0);
assert.equal(list_info.more_topics_have_unread_mention_messages, false);