diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js index 5f828c0a34..2e0c67531b 100644 --- a/frontend_tests/node_tests/drafts.js +++ b/frontend_tests/node_tests/drafts.js @@ -227,8 +227,8 @@ run_test("remove_old_drafts", () => { assert.deepEqual(draft_model.get(), {id3: draft_3}); }); -run_test("format_drafts", () => { - drafts.remove_old_drafts = noop; +run_test("format_drafts", (override) => { + override("drafts.remove_old_drafts", noop); draft_1.updatedAt = new Date(1549958107000).getTime(); // 2/12/2019 07:55:07 AM (UTC+0) draft_2.updatedAt = new Date(1549958107000).setDate(-1); @@ -319,7 +319,7 @@ run_test("format_drafts", () => { return ""; }); - drafts.open_overlay = noop; + override("drafts.open_overlay", noop); drafts.set_initial_element = noop; $("#drafts_table .draft-row").length = 0; diff --git a/frontend_tests/node_tests/general.js b/frontend_tests/node_tests/general.js index 4461381922..e64e0b7749 100644 --- a/frontend_tests/node_tests/general.js +++ b/frontend_tests/node_tests/general.js @@ -327,7 +327,7 @@ set_global("settings_users", {}); zrequire("user_events"); -run_test("update_user_event", () => { +run_test("update_user_event", (override) => { const new_bob = { email: "bob@example.com", user_id: bob.user_id, @@ -341,10 +341,10 @@ run_test("update_user_event", () => { }; // We have to stub a few things: - activity.redraw = noop; - message_live_update.update_user_full_name = noop; - pm_list.update_private_messages = noop; - settings_users.update_user_data = noop; + override("activity.redraw", noop); + override("message_live_update.update_user_full_name", noop); + override("pm_list.update_private_messages", noop); + override("settings_users.update_user_data", noop); // Dispatch the realm_user/update event, which will update // data structures and have other side effects that are @@ -412,7 +412,9 @@ set_global("unread_ui", {}); zrequire("message_events"); -run_test("insert_message", () => { +run_test("insert_message", (override) => { + override("pm_list.update_private_messages", noop); + const helper = test_helper(); const new_message = { diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js index f698fcad6c..26c5ca4982 100644 --- a/frontend_tests/node_tests/popovers.js +++ b/frontend_tests/node_tests/popovers.js @@ -14,7 +14,6 @@ const noop = function () {}; $.fn.popover = noop; // this will get wrapped by our code zrequire("popovers"); -popovers.hide_user_profile = noop; set_global("current_msg_list", {}); set_global("page_params", { @@ -105,7 +104,9 @@ function make_image_stubber() { popovers.register_click_handlers(); -run_test("sender_hover", () => { +run_test("sender_hover", (override) => { + override("popovers.hide_user_profile", noop); + const selection = ".sender_name, .sender_name-in-status, .inline_profile_picture"; const handler = $("#main_div").get_on_handler("click", selection); @@ -194,7 +195,9 @@ run_test("sender_hover", () => { // todo: load image }); -run_test("actions_popover", () => { +run_test("actions_popover", (override) => { + override("popovers.hide_user_profile", noop); + const handler = $("#main_div").get_on_handler("click", ".actions_hover"); window.location = { diff --git a/frontend_tests/node_tests/search.js b/frontend_tests/node_tests/search.js index 5e4d13e3ee..5388c40a0c 100644 --- a/frontend_tests/node_tests/search.js +++ b/frontend_tests/node_tests/search.js @@ -24,9 +24,6 @@ set_global("search_pill_widget", { }, }); -search_pill.append_search_string = noop; -search_pill.get_search_string_for_current_filter = noop; - global.patch_builtin("setTimeout", (func) => func()); run_test("clear_search_form", () => { diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index f0a3d06390..fe4dc8736f 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -733,7 +733,7 @@ function test_discard_changes_button(discard_changes) { settings_org.change_save_button_state = stubbed_function; } -run_test("set_up", () => { +run_test("set_up", (override) => { const verify_realm_domains = simulate_realm_domains_table(); page_params.realm_available_video_chat_providers = { jitsi_meet: { @@ -785,7 +785,7 @@ run_test("set_up", () => { // TEST set_up() here, but this mostly just allows us to // get access to the click handlers. - settings_org.maybe_disable_widgets = noop; + override("settings_org.maybe_disable_widgets", noop); settings_org.set_up(); verify_realm_domains(); @@ -1030,7 +1030,6 @@ run_test("misc", () => { assert.equal(elem.text(), "#some_stream"); assert(!elem.hasClass("text-warning")); - stream_data.get_sub_by_id = noop; settings_org.notifications_stream_widget.render(undefined); assert.equal(elem.text(), "translated: Disabled"); assert(elem.hasClass("text-warning")); @@ -1048,7 +1047,6 @@ run_test("misc", () => { assert.equal(elem.text(), "#some_stream"); assert(!elem.hasClass("text-warning")); - stream_data.get_sub_by_id = noop; settings_org.signup_notifications_stream_widget.render(undefined); assert.equal(elem.text(), "translated: Disabled"); assert(elem.hasClass("text-warning"));