mirror of https://github.com/zulip/zulip.git
node test: Use override in more places.
I also removed some useless stubs in passing.
This commit is contained in:
parent
c9bb6ab843
commit
10bb60e13d
|
@ -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 "<draft table stub>";
|
||||
});
|
||||
|
||||
drafts.open_overlay = noop;
|
||||
override("drafts.open_overlay", noop);
|
||||
drafts.set_initial_element = noop;
|
||||
$("#drafts_table .draft-row").length = 0;
|
||||
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
|
@ -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"));
|
||||
|
|
Loading…
Reference in New Issue