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 unused rewiremocks.

Anders Kaseorg2a2373307f2e
diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js
index 53d793b5746..86a3be13b54 100644
--- a/frontend_tests/node_tests/drafts.js
+++ b/frontend_tests/node_tests/drafts.js
@@ -26,7 +26,6 @@ const localStorage = set_global("localStorage", {
ls_container.clear();
},
});
-rewiremock("../../static/js/compose").with({});
const compose_state = {__esModule: true};
rewiremock("../../static/js/compose_state").with(compose_state);
rewiremock("../../static/js/stream_data").with({
diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.js
index 1cc5cead472..700ceb33054 100644
--- a/frontend_tests/node_tests/hotkey.js
+++ b/frontend_tests/node_tests/hotkey.js
@@ -85,7 +85,6 @@ const hashchange = {
in_recent_topics_hash: () => false,
};
rewiremock("../../static/js/hashchange").with(hashchange);
-rewiremock("../../static/js/info_overlay").with({});
const lightbox = {__esModule: true};
rewiremock("../../static/js/lightbox").with(lightbox);
const list_util = {__esModule: true};
diff --git a/frontend_tests/node_tests/message_fetch.js b/frontend_tests/node_tests/message_fetch.js
index bb7803d3718..6d001e8122f 100644
--- a/frontend_tests/node_tests/message_fetch.js
+++ b/frontend_tests/node_tests/message_fetch.js
@@ -43,8 +43,6 @@ const message_util = {__esModule: true};
rewiremock("../../static/js/message_util").with(message_util);
const message_store = {__esModule: true};
rewiremock("../../static/js/message_store").with(message_store);
-const narrow_state = {__esModule: true};
-rewiremock("../../static/js/narrow_state").with(narrow_state);
const pm_list = {__esModule: true};
rewiremock("../../static/js/pm_list").with(pm_list);
const server_events = {__esModule: true};
@@ -312,8 +310,6 @@ function simulate_narrow() {
public_operators: () => [{operator: "pm-with", operand: alice.email}],
};
- narrow_state.active = () => true;
-
const msg_list = new message_list.MessageList({
table_name: "zfilt",
filter,
diff --git a/frontend_tests/node_tests/message_list.js b/frontend_tests/node_tests/message_list.js
index e2b5ac43b72..de6bba7b6e0 100644
--- a/frontend_tests/node_tests/message_list.js
+++ b/frontend_tests/node_tests/message_list.js
@@ -30,9 +30,6 @@ const narrow_state = {__esModule: true};
rewiremock("../../static/js/narrow_state").with(narrow_state);
const stream_data = {__esModule: true};
rewiremock("../../static/js/stream_data").with(stream_data);
-rewiremock("../../static/js/recent_topics").with({
- is_visible: () => false,
-});
rewiremock.enable();
diff --git a/frontend_tests/node_tests/narrow.js b/frontend_tests/node_tests/narrow.js
index 3e213ed5c45..9445a0954b0 100644
--- a/frontend_tests/node_tests/narrow.js
+++ b/frontend_tests/node_tests/narrow.js
@@ -11,10 +11,6 @@ const $ = require("../zjsunit/zjquery");
set_global("page_params", {
stop_words: ["what", "about"],
});
-rewiremock("../../static/js/resize").with({
- resize_page_components: () => {},
- resize_stream_filters_container: () => {},
-});
rewiremock.enable();
diff --git a/frontend_tests/node_tests/narrow_activate.js b/frontend_tests/node_tests/narrow_activate.js
index 09886b65701..1192ba8cece 100644
--- a/frontend_tests/node_tests/narrow_activate.js
+++ b/frontend_tests/node_tests/narrow_activate.js
@@ -29,7 +29,6 @@ const message_list = set_global("message_list", {
});
const message_scroll = {__esModule: true};
rewiremock("../../static/js/message_scroll").with(message_scroll);
-rewiremock("../../static/js/message_util").with({});
const notifications = {__esModule: true};
rewiremock("../../static/js/notifications").with(notifications);
set_global("page_params", {});
@@ -45,16 +44,6 @@ rewiremock("../../static/js/typing_events").with(typing_events);
const ui_util = {__esModule: true};
rewiremock("../../static/js/ui_util").with(ui_util);
const unread_ops = set_global("unread_ops", {});
-rewiremock("../../static/js/search_pill_widget").with({
- widget: {
- clear() {
- return true;
- },
- appendValue() {
- return true;
- },
- },
-});
rewiremock("../../static/js/recent_topics").with({
hide: () => {},
is_visible: () => {},
diff --git a/frontend_tests/node_tests/narrow_local.js b/frontend_tests/node_tests/narrow_local.js
index e0b034e0a0d..9d13f001722 100644
--- a/frontend_tests/node_tests/narrow_local.js
+++ b/frontend_tests/node_tests/narrow_local.js
@@ -2,17 +2,10 @@
const {strict: assert} = require("assert");
-const rewiremock = require("rewiremock/node");
-
const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const message_list = set_global("message_list", {});
-rewiremock("../../static/js/muting").with({
- is_topic_muted: () => false,
-});
-
-rewiremock.enable();
const {Filter} = zrequire("Filter", "js/filter");
const {MessageListData} = zrequire("MessageListData", "js/message_list_data");
@@ -452,4 +445,3 @@ run_test("final corner case", () => {
test_with(fixture);
});
-rewiremock.disable();
diff --git a/frontend_tests/node_tests/notifications.js b/frontend_tests/node_tests/notifications.js
index b52d9cdf5bf..a991204512f 100644
--- a/frontend_tests/node_tests/notifications.js
+++ b/frontend_tests/node_tests/notifications.js
@@ -2,8 +2,6 @@
const {strict: assert} = require("assert");
-const rewiremock = require("rewiremock/node");
-
const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
@@ -25,9 +23,6 @@ const _navigator = {
userAgent: "Mozilla/5.0 AppleWebKit/537.36 Chrome/64.0.3282.167 Safari/537.36",
};
set_global("navigator", _navigator);
-rewiremock("../../static/js/favicon").with({});
-
-rewiremock.enable();
const muting = zrequire("muting");
const stream_data = zrequire("stream_data");
@@ -360,5 +355,3 @@ run_test("basic_notifications", (override) => {
assert.equal(n.size, 0);
assert.equal(last_closed_message_id, message_2.id);
});
-
-rewiremock.disable();
diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js
index b2f3089fffc..761768fd536 100644
--- a/frontend_tests/node_tests/settings_org.js
+++ b/frontend_tests/node_tests/settings_org.js
@@ -70,11 +70,6 @@ const _ui_report = {
},
};
-const _realm_logo = {
- __esModule: true,
- build_realm_logo_widget: noop,
-};
-
const _ListWidget = {
__esModule: true,
create: () => ({init: noop}),
@@ -84,14 +79,9 @@ set_global("csrf_token", "token-stub");
set_global("FormData", _FormData);
set_global("jQuery", _jQuery);
rewiremock("../../static/js/loading").with(_loading);
-rewiremock("../../static/js/realm_logo").with(_realm_logo);
rewiremock("../../static/js/ui_report").with(_ui_report);
rewiremock("../../static/js/list_widget").with(_ListWidget);
-// setup is only imported to set the
-// setup.password_change_in_progress flag.
-rewiremock("../../static/js/setup").with({});
-
rewiremock.enable();
const settings_config = zrequire("settings_config");
diff --git a/frontend_tests/node_tests/stream_edit.js b/frontend_tests/node_tests/stream_edit.js
index f97a98ee4e2..482e7355665 100644
--- a/frontend_tests/node_tests/stream_edit.js
+++ b/frontend_tests/node_tests/stream_edit.js
@@ -12,7 +12,6 @@ const $ = require("../zjsunit/zjquery");
const noop = () => {};
stub_templates(() => noop);
-rewiremock("../../static/js/channel").with({});
rewiremock("../../static/js/hashchange").with({update_browser_history: noop});
rewiremock("../../static/js/hash_util").with({
stream_edit_uri: noop,
diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.js
index 587f0bb05ed..8087e6f26fb 100644
--- a/frontend_tests/node_tests/stream_list.js
+++ b/frontend_tests/node_tests/stream_list.js
@@ -20,8 +20,6 @@ const noop = () => {};
const topic_list = {__esModule: true};
rewiremock("../../static/js/topic_list").with(topic_list);
-rewiremock("../../static/js/overlays").with({});
-rewiremock("../../static/js/popovers").with({});
rewiremock("../../static/js/keydown_util").with({
handle: noop,
diff --git a/frontend_tests/node_tests/ui_init.js b/frontend_tests/node_tests/ui_init.js
index c5595bab120..a8f090f9bbf 100644
--- a/frontend_tests/node_tests/ui_init.js
+++ b/frontend_tests/node_tests/ui_init.js
@@ -84,7 +84,6 @@ const message_viewport = {
};
rewiremock("../../static/js/message_viewport").with(message_viewport);
rewiremock("../../static/js/panels").with({initialize() {}});
-rewiremock("../../static/js/popovers").with({initialize() {}});
rewiremock("../../static/js/reload").with({initialize() {}});
rewiremock("../../static/js/scroll_bar").with({initialize() {}});
const server_events = {
@@ -104,7 +103,6 @@ server_events.home_view_loaded = () => true;
resize.watch_manual_resize = () => {};
-rewiremock("../../static/js/favicon").with({});
rewiremock("../../static/js/emojisets").with({
initialize: () => {},
});
diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js
index d99b1bd60a1..e9da94c976c 100644
--- a/frontend_tests/node_tests/unread.js
+++ b/frontend_tests/node_tests/unread.js
@@ -12,7 +12,6 @@ let page_params = set_global("page_params", {
realm_push_notifications_enabled: false,
});
-rewiremock("../../static/js/narrow_state").with({});
set_global("current_msg_list", {});
set_global("home_msg_list", {});
const message_store = {__esModule: true};