mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
node tests: Remove __esModule cruft.
We just set __esModule in our rewiremock helper.
This commit is contained in:
committed by
Steve Howell
parent
30c7108955
commit
167fda142c
@@ -23,42 +23,35 @@ const _document = {
|
||||
},
|
||||
};
|
||||
|
||||
const channel = {__esModule: true};
|
||||
const channel = {};
|
||||
|
||||
const _keydown_util = {
|
||||
__esModule: true,
|
||||
|
||||
handle: (opts) => {
|
||||
filter_key_handlers = opts.handlers;
|
||||
},
|
||||
};
|
||||
|
||||
const compose_state = {__esModule: true};
|
||||
const compose_state = {};
|
||||
|
||||
const _scroll_util = {
|
||||
__esModule: true,
|
||||
scroll_element_into_container: () => {},
|
||||
};
|
||||
|
||||
const _pm_list = {
|
||||
__esModule: true,
|
||||
update_private_messages: () => {},
|
||||
};
|
||||
|
||||
const _popovers = {
|
||||
__esModule: true,
|
||||
hide_all_except_sidebars() {},
|
||||
hide_all() {},
|
||||
show_userlist_sidebar() {},
|
||||
};
|
||||
|
||||
const _stream_popover = {
|
||||
__esModule: true,
|
||||
show_streamlist_sidebar() {},
|
||||
};
|
||||
|
||||
const _resize = {
|
||||
__esModule: true,
|
||||
resize_sidebars: () => {},
|
||||
resize_page_components: () => {},
|
||||
};
|
||||
@@ -68,16 +61,16 @@ rewiremock("../../static/js/padded_widget").with({
|
||||
});
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
rewiremock("../../static/js/compose_state").with(compose_state);
|
||||
set_global("document", _document);
|
||||
rewiremock("../../static/js/keydown_util").with(_keydown_util);
|
||||
rewiremock("../../static/js/pm_list").with(_pm_list);
|
||||
rewiremock("../../static/js/popovers").with(_popovers);
|
||||
rewiremock("../../static/js/resize").with(_resize);
|
||||
rewiremock("../../static/js/scroll_util").with(_scroll_util);
|
||||
rewiremock("../../static/js/stream_popover").with(_stream_popover);
|
||||
rewiremock("../../static/js/server_events").with({
|
||||
check_for_unsuspend() {},
|
||||
});
|
||||
rewiremock("../../static/js/stream_popover").with(_stream_popover);
|
||||
set_global("document", _document);
|
||||
|
||||
const huddle_data = zrequire("huddle_data");
|
||||
const compose_fade = zrequire("compose_fade");
|
||||
|
||||
@@ -7,11 +7,11 @@ const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const channel = {__esModule: true};
|
||||
const channel = {};
|
||||
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
|
||||
const alert_words = zrequire("alert_words");
|
||||
|
||||
const alert_words_ui = zrequire("alert_words_ui");
|
||||
|
||||
alert_words.initialize({
|
||||
|
||||
@@ -14,13 +14,12 @@ const dom = new JSDOM(template, {pretendToBeVisual: true});
|
||||
const document = dom.window.document;
|
||||
|
||||
const helpers = {
|
||||
__esModule: true,
|
||||
set_tab: () => {},
|
||||
};
|
||||
rewiremock("../../static/js/billing/helpers").with(helpers);
|
||||
const StripeCheckout = set_global("StripeCheckout", {
|
||||
configure: () => {},
|
||||
});
|
||||
rewiremock("../../static/js/billing/helpers").with(helpers);
|
||||
|
||||
run_test("initialize", (override) => {
|
||||
let token_func;
|
||||
|
||||
@@ -15,9 +15,8 @@ const dom = new JSDOM(template, {pretendToBeVisual: true});
|
||||
const jquery = jQueryFactory(dom.window);
|
||||
|
||||
const page_params = set_global("page_params", {});
|
||||
const loading = {__esModule: true};
|
||||
rewiremock("../../static/js/loading").with(loading);
|
||||
const history = set_global("history", {});
|
||||
const loading = rewiremock("../../static/js/loading").with({});
|
||||
set_global("document", {
|
||||
title: "Zulip",
|
||||
});
|
||||
|
||||
@@ -6,13 +6,12 @@ const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const _settings_bots = {
|
||||
__esModule: true,
|
||||
render_bots: () => {},
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/settings_bots").with(_settings_bots);
|
||||
|
||||
const bot_data = zrequire("bot_data");
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
const me = {
|
||||
|
||||
@@ -9,11 +9,11 @@ const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const page_params = set_global("page_params", {});
|
||||
|
||||
const timerender = {__esModule: true};
|
||||
const timerender = {};
|
||||
|
||||
rewiremock("../../static/js/timerender").with(timerender);
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
const presence = zrequire("presence");
|
||||
const user_status = zrequire("user_status");
|
||||
const buddy_data = zrequire("buddy_data");
|
||||
|
||||
@@ -7,10 +7,9 @@ const _ = require("lodash");
|
||||
const {rewiremock, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const reload = {__esModule: true};
|
||||
const reload = {};
|
||||
|
||||
rewiremock("../../static/js/reload").with(reload);
|
||||
|
||||
set_global("setTimeout", (f, delay) => {
|
||||
assert.equal(delay, 0);
|
||||
f();
|
||||
|
||||
@@ -19,6 +19,7 @@ let compose_actions_expected_opts;
|
||||
|
||||
rewiremock("../../static/js/compose_actions").with({
|
||||
update_placeholder_text: noop,
|
||||
|
||||
start(msg_type, opts) {
|
||||
assert.equal(msg_type, "stream");
|
||||
assert.deepEqual(opts, compose_actions_expected_opts);
|
||||
@@ -26,8 +27,7 @@ rewiremock("../../static/js/compose_actions").with({
|
||||
},
|
||||
});
|
||||
|
||||
const server_events = rewiremock("../../static/js/server_events").with({__esModule: true});
|
||||
|
||||
const server_events = rewiremock("../../static/js/server_events").with({});
|
||||
const _navigator = {
|
||||
platform: "",
|
||||
};
|
||||
@@ -41,56 +41,44 @@ const _document = {
|
||||
};
|
||||
|
||||
const _drafts = {
|
||||
__esModule: true,
|
||||
delete_draft_after_send: noop,
|
||||
};
|
||||
|
||||
const sent_messages = {
|
||||
__esModule: true,
|
||||
start_tracking_message: noop,
|
||||
};
|
||||
const _notifications = {
|
||||
__esModule: true,
|
||||
notify_above_composebox: noop,
|
||||
clear_compose_notifications: noop,
|
||||
};
|
||||
const reminder = {
|
||||
__esModule: true,
|
||||
is_deferred_delivery: noop,
|
||||
};
|
||||
|
||||
set_global("document", _document);
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const loading = rewiremock("../../static/js/loading").with({});
|
||||
const local_message = rewiremock("../../static/js/local_message").with({});
|
||||
const markdown = rewiremock("../../static/js/markdown").with({});
|
||||
const page_params = set_global("page_params", {});
|
||||
const resize = rewiremock("../../static/js/resize").with({});
|
||||
const stream_edit = rewiremock("../../static/js/stream_edit").with({});
|
||||
const subs = rewiremock("../../static/js/subs").with({});
|
||||
const transmit = rewiremock("../../static/js/transmit").with({});
|
||||
rewiremock("../../static/js/drafts").with(_drafts);
|
||||
set_global("navigator", _navigator);
|
||||
rewiremock("../../static/js/notifications").with(_notifications);
|
||||
rewiremock("../../static/js/reminder").with(reminder);
|
||||
rewiremock("../../static/js/sent_messages").with(sent_messages);
|
||||
rewiremock("../../static/js/rendered_markdown").with({
|
||||
update_elements: () => {},
|
||||
});
|
||||
rewiremock("../../static/js/sent_messages").with(sent_messages);
|
||||
set_global("navigator", _navigator);
|
||||
|
||||
const local_message = {__esModule: true};
|
||||
rewiremock("../../static/js/local_message").with(local_message);
|
||||
const transmit = {__esModule: true};
|
||||
rewiremock("../../static/js/transmit").with(transmit);
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const stream_edit = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_edit").with(stream_edit);
|
||||
const markdown = {__esModule: true};
|
||||
rewiremock("../../static/js/markdown").with(markdown);
|
||||
const loading = {__esModule: true};
|
||||
rewiremock("../../static/js/loading").with(loading);
|
||||
const page_params = set_global("page_params", {});
|
||||
const resize = {__esModule: true};
|
||||
rewiremock("../../static/js/resize").with(resize);
|
||||
const subs = {__esModule: true};
|
||||
rewiremock("../../static/js/subs").with(subs);
|
||||
const ui_util = {__esModule: true};
|
||||
const ui_util = {};
|
||||
|
||||
rewiremock("../../static/js/ui_util").with(ui_util);
|
||||
|
||||
// Setting these up so that we can test that links to uploads within messages are
|
||||
|
||||
// automatically converted to server relative links.
|
||||
document.location.protocol = "https:";
|
||||
document.location.host = "foo.com";
|
||||
|
||||
@@ -15,59 +15,50 @@ set_global("document", {
|
||||
to_$: () => $("document-stub"),
|
||||
});
|
||||
|
||||
const compose_pm_pill = {__esModule: true};
|
||||
const compose_pm_pill = {};
|
||||
|
||||
rewiremock("../../static/js/compose_pm_pill").with(compose_pm_pill);
|
||||
|
||||
const hash_util = {__esModule: true};
|
||||
const hash_util = {};
|
||||
|
||||
rewiremock("../../static/js/hash_util").with(hash_util);
|
||||
|
||||
rewiremock("../../static/js/notifications").with({
|
||||
clear_compose_notifications: noop,
|
||||
});
|
||||
rewiremock("../../static/js/reload_state").with({
|
||||
is_in_progress: () => false,
|
||||
});
|
||||
|
||||
rewiremock("../../static/js/notifications").with({
|
||||
clear_compose_notifications: noop,
|
||||
});
|
||||
|
||||
const compose_fade = {
|
||||
__esModule: true,
|
||||
clear_compose: noop,
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/compose_fade").with(compose_fade);
|
||||
|
||||
rewiremock("../../static/js/drafts").with({
|
||||
update_draft: noop,
|
||||
});
|
||||
|
||||
const narrow_state = {
|
||||
__esModule: true,
|
||||
set_compose_defaults: noop,
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/narrow_state").with(narrow_state);
|
||||
|
||||
rewiremock("../../static/js/unread_ops").with({
|
||||
notify_server_message_read: noop,
|
||||
});
|
||||
|
||||
rewiremock("../../static/js/common").with({
|
||||
status_classes: "status_classes",
|
||||
});
|
||||
|
||||
rewiremock("../../static/js/narrow_state").with(narrow_state);
|
||||
rewiremock("../../static/js/unread_ops").with({
|
||||
notify_server_message_read: noop,
|
||||
});
|
||||
set_global("current_msg_list", {
|
||||
can_mark_messages_read() {
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
const channel = {__esModule: true};
|
||||
const channel = {};
|
||||
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
const compose_ui = zrequire("compose_ui");
|
||||
const compose = zrequire("compose");
|
||||
const compose_state = zrequire("compose_state");
|
||||
|
||||
@@ -6,10 +6,9 @@ const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const compose_actions = {__esModule: true};
|
||||
rewiremock("../../static/js/compose_actions").with(compose_actions);
|
||||
|
||||
const compose_actions = rewiremock("../../static/js/compose_actions").with({});
|
||||
const people = zrequire("people");
|
||||
|
||||
const compose_pm_pill = zrequire("compose_pm_pill");
|
||||
const input_pill = zrequire("input_pill");
|
||||
|
||||
|
||||
@@ -5,10 +5,9 @@ const {strict: assert} = require("assert");
|
||||
const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const compose_pm_pill = {__esModule: true};
|
||||
const compose_pm_pill = {};
|
||||
|
||||
rewiremock("../../static/js/compose_pm_pill").with(compose_pm_pill);
|
||||
|
||||
const compose_state = zrequire("compose_state");
|
||||
|
||||
run_test("private_message_recipient", (override) => {
|
||||
|
||||
@@ -9,19 +9,12 @@ const $ = require("../zjsunit/zjquery");
|
||||
const events = require("./lib/events");
|
||||
|
||||
const resize = {
|
||||
__esModule: true,
|
||||
watch_manual_resize() {},
|
||||
};
|
||||
rewiremock("../../static/js/resize").with(resize);
|
||||
|
||||
const upload = {__esModule: true};
|
||||
rewiremock("../../static/js/upload").with(upload);
|
||||
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const page_params = set_global("page_params", {});
|
||||
|
||||
const upload = rewiremock("../../static/js/upload").with({});
|
||||
rewiremock("../../static/js/resize").with(resize);
|
||||
set_global("csrf_token", "fake-csrf-token");
|
||||
set_global("document", {
|
||||
execCommand() {
|
||||
|
||||
@@ -8,28 +8,24 @@ const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
const stream_topic_history = {__esModule: true};
|
||||
const stream_topic_history = {};
|
||||
|
||||
rewiremock("../../static/js/stream_topic_history").with(stream_topic_history);
|
||||
|
||||
const message_store = {
|
||||
__esModule: true,
|
||||
user_ids: () => [],
|
||||
};
|
||||
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const page_params = set_global("page_params", {});
|
||||
rewiremock("../../static/js/message_store").with(message_store);
|
||||
|
||||
const page_params = set_global("page_params", {});
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const compose = {
|
||||
__esModule: true,
|
||||
finish: noop,
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/compose").with(compose);
|
||||
|
||||
let autosize_called;
|
||||
|
||||
rewiremock("../../static/js/compose_ui").with({
|
||||
autosize_textarea() {
|
||||
autosize_called = true;
|
||||
|
||||
@@ -11,11 +11,11 @@ const {run_test} = require("../zjsunit/test");
|
||||
set_global("page_params", {
|
||||
development_environment: true,
|
||||
});
|
||||
const compose_ui = {__esModule: true};
|
||||
const compose_ui = {};
|
||||
|
||||
rewiremock("../../static/js/compose_ui").with(compose_ui);
|
||||
|
||||
const {window} = new JSDOM("<!DOCTYPE html><p>Hello world</p>");
|
||||
|
||||
const {DOMParser, document} = window;
|
||||
const $ = set_global("$", jquery(window));
|
||||
|
||||
|
||||
@@ -18,92 +18,54 @@ const typing_person1 = events.typing_person1;
|
||||
|
||||
set_global("setTimeout", (func) => func());
|
||||
|
||||
const activity = {__esModule: true};
|
||||
rewiremock("../../static/js/activity").with(activity);
|
||||
const alert_words_ui = {__esModule: true};
|
||||
rewiremock("../../static/js/alert_words_ui").with(alert_words_ui);
|
||||
const attachments_ui = {__esModule: true};
|
||||
rewiremock("../../static/js/attachments_ui").with(attachments_ui);
|
||||
const bot_data = {__esModule: true};
|
||||
rewiremock("../../static/js/bot_data").with(bot_data);
|
||||
const activity = rewiremock("../../static/js/activity").with({});
|
||||
const alert_words_ui = rewiremock("../../static/js/alert_words_ui").with({});
|
||||
const attachments_ui = rewiremock("../../static/js/attachments_ui").with({});
|
||||
const bot_data = rewiremock("../../static/js/bot_data").with({});
|
||||
const composebox_typeahead = rewiremock("../../static/js/composebox_typeahead").with({});
|
||||
const emoji_picker = rewiremock("../../static/js/emoji_picker").with({});
|
||||
const hotspots = rewiremock("../../static/js/hotspots").with({});
|
||||
const markdown = rewiremock("../../static/js/markdown").with({});
|
||||
const message_edit = rewiremock("../../static/js/message_edit").with({});
|
||||
const message_events = rewiremock("../../static/js/message_events").with({});
|
||||
const message_list = rewiremock("../../static/js/message_list").with({});
|
||||
const muting_ui = rewiremock("../../static/js/muting_ui").with({});
|
||||
const night_mode = rewiremock("../../static/js/night_mode").with({});
|
||||
const notifications = rewiremock("../../static/js/notifications").with({});
|
||||
const reactions = rewiremock("../../static/js/reactions").with({});
|
||||
const realm_icon = rewiremock("../../static/js/realm_icon").with({});
|
||||
const realm_logo = rewiremock("../../static/js/realm_logo").with({});
|
||||
const reload = rewiremock("../../static/js/reload").with({});
|
||||
const scroll_bar = rewiremock("../../static/js/scroll_bar").with({});
|
||||
const settings_account = rewiremock("../../static/js/settings_account").with({});
|
||||
const settings_bots = rewiremock("../../static/js/settings_bots").with({});
|
||||
const settings_display = rewiremock("../../static/js/settings_display").with({});
|
||||
const settings_emoji = rewiremock("../../static/js/settings_emoji").with({});
|
||||
const settings_exports = rewiremock("../../static/js/settings_exports").with({});
|
||||
const settings_invites = rewiremock("../../static/js/settings_invites").with({});
|
||||
const settings_linkifiers = rewiremock("../../static/js/settings_linkifiers").with({});
|
||||
const settings_notifications = rewiremock("../../static/js/settings_notifications").with({});
|
||||
const settings_org = rewiremock("../../static/js/settings_org").with({});
|
||||
const settings_profile_fields = rewiremock("../../static/js/settings_profile_fields").with({});
|
||||
const settings_streams = rewiremock("../../static/js/settings_streams").with({});
|
||||
const settings_user_groups = rewiremock("../../static/js/settings_user_groups").with({});
|
||||
const settings_users = rewiremock("../../static/js/settings_users").with({});
|
||||
const stream_data = rewiremock("../../static/js/stream_data").with({});
|
||||
const stream_events = rewiremock("../../static/js/stream_events").with({});
|
||||
const submessage = rewiremock("../../static/js/submessage").with({});
|
||||
const typing_events = rewiremock("../../static/js/typing_events").with({});
|
||||
const ui = rewiremock("../../static/js/ui").with({});
|
||||
const unread_ops = rewiremock("../../static/js/unread_ops").with({});
|
||||
const user_events = rewiremock("../../static/js/user_events").with({});
|
||||
rewiremock("../../static/js/compose").with({});
|
||||
const composebox_typeahead = {__esModule: true};
|
||||
rewiremock("../../static/js/composebox_typeahead").with(composebox_typeahead);
|
||||
set_global("current_msg_list", {});
|
||||
const emoji_picker = {__esModule: true};
|
||||
rewiremock("../../static/js/emoji_picker").with(emoji_picker);
|
||||
set_global("home_msg_list", {});
|
||||
const hotspots = {__esModule: true};
|
||||
rewiremock("../../static/js/hotspots").with(hotspots);
|
||||
const markdown = {__esModule: true};
|
||||
rewiremock("../../static/js/markdown").with(markdown);
|
||||
const message_edit = {__esModule: true};
|
||||
rewiremock("../../static/js/message_edit").with(message_edit);
|
||||
const message_events = {__esModule: true};
|
||||
rewiremock("../../static/js/message_events").with(message_events);
|
||||
const message_list = {__esModule: true};
|
||||
rewiremock("../../static/js/message_list").with(message_list);
|
||||
const muting_ui = {__esModule: true};
|
||||
rewiremock("../../static/js/muting_ui").with(muting_ui);
|
||||
const night_mode = {__esModule: true};
|
||||
rewiremock("../../static/js/night_mode").with(night_mode);
|
||||
const notifications = {__esModule: true};
|
||||
rewiremock("../../static/js/notifications").with(notifications);
|
||||
const reactions = {__esModule: true};
|
||||
rewiremock("../../static/js/reactions").with(reactions);
|
||||
const realm_icon = {__esModule: true};
|
||||
rewiremock("../../static/js/realm_icon").with(realm_icon);
|
||||
const realm_logo = {__esModule: true};
|
||||
rewiremock("../../static/js/realm_logo").with(realm_logo);
|
||||
const reload = {__esModule: true};
|
||||
rewiremock("../../static/js/reload").with(reload);
|
||||
const scroll_bar = {__esModule: true};
|
||||
rewiremock("../../static/js/scroll_bar").with(scroll_bar);
|
||||
const settings_account = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_account").with(settings_account);
|
||||
const settings_bots = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_bots").with(settings_bots);
|
||||
const settings_display = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_display").with(settings_display);
|
||||
const settings_emoji = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_emoji").with(settings_emoji);
|
||||
const settings_exports = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_exports").with(settings_exports);
|
||||
const settings_invites = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_invites").with(settings_invites);
|
||||
const settings_linkifiers = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_linkifiers").with(settings_linkifiers);
|
||||
const settings_notifications = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_notifications").with(settings_notifications);
|
||||
const settings_org = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_org").with(settings_org);
|
||||
const settings_profile_fields = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_profile_fields").with(settings_profile_fields);
|
||||
const settings_streams = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_streams").with(settings_streams);
|
||||
const settings_user_groups = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_user_groups").with(settings_user_groups);
|
||||
const settings_users = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_users").with(settings_users);
|
||||
const stream_data = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_data").with(stream_data);
|
||||
const stream_events = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_events").with(stream_events);
|
||||
const submessage = {__esModule: true};
|
||||
rewiremock("../../static/js/submessage").with(submessage);
|
||||
const typing_events = {__esModule: true};
|
||||
rewiremock("../../static/js/typing_events").with(typing_events);
|
||||
const ui = {__esModule: true};
|
||||
rewiremock("../../static/js/ui").with(ui);
|
||||
const unread_ops = {__esModule: true};
|
||||
rewiremock("../../static/js/unread_ops").with(unread_ops);
|
||||
const user_events = {__esModule: true};
|
||||
rewiremock("../../static/js/user_events").with(user_events);
|
||||
const user_groups = {__esModule: true};
|
||||
|
||||
const user_groups = {};
|
||||
|
||||
rewiremock("../../static/js/user_groups").with(user_groups);
|
||||
|
||||
// page_params is highly coupled to dispatching now
|
||||
|
||||
const page_params = set_global("page_params", {
|
||||
test_suite: false,
|
||||
is_admin: true,
|
||||
|
||||
@@ -11,29 +11,24 @@ const events = require("./lib/events");
|
||||
const event_fixtures = events.fixtures;
|
||||
const test_user = events.test_user;
|
||||
|
||||
const compose_fade = {__esModule: true};
|
||||
rewiremock("../../static/js/compose_fade").with(compose_fade);
|
||||
const stream_events = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_events").with(stream_events);
|
||||
const subs = {__esModule: true};
|
||||
const compose_fade = rewiremock("../../static/js/compose_fade").with({});
|
||||
const stream_events = rewiremock("../../static/js/stream_events").with({});
|
||||
|
||||
rewiremock("../../static/js/subs").with(subs);
|
||||
const subs = {};
|
||||
|
||||
set_global("current_msg_list", {});
|
||||
const narrow_state = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow_state").with(narrow_state);
|
||||
const narrow_state = rewiremock("../../static/js/narrow_state").with({});
|
||||
const overlays = rewiremock("../../static/js/overlays").with({});
|
||||
const page_params = set_global("page_params", {});
|
||||
const overlays = {__esModule: true};
|
||||
rewiremock("../../static/js/overlays").with(overlays);
|
||||
const settings_org = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_org").with(settings_org);
|
||||
const settings_streams = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_streams").with(settings_streams);
|
||||
const stream_list = {__esModule: true};
|
||||
const settings_org = rewiremock("../../static/js/settings_org").with({});
|
||||
const settings_streams = rewiremock("../../static/js/settings_streams").with({});
|
||||
rewiremock("../../static/js/subs").with(subs);
|
||||
set_global("current_msg_list", {});
|
||||
|
||||
const stream_list = {};
|
||||
|
||||
rewiremock("../../static/js/stream_list").with(stream_list);
|
||||
|
||||
const peer_data = zrequire("peer_data");
|
||||
|
||||
const people = zrequire("people");
|
||||
const stream_data = zrequire("stream_data");
|
||||
|
||||
|
||||
@@ -24,16 +24,15 @@ const localStorage = set_global("localStorage", {
|
||||
ls_container.clear();
|
||||
},
|
||||
});
|
||||
const compose_state = {__esModule: true};
|
||||
rewiremock("../../static/js/compose_state").with(compose_state);
|
||||
const compose_state = rewiremock("../../static/js/compose_state").with({});
|
||||
rewiremock("../../static/js/markdown").with({
|
||||
apply_markdown: noop,
|
||||
});
|
||||
rewiremock("../../static/js/stream_data").with({
|
||||
get_color() {
|
||||
return "#FFFFFF";
|
||||
},
|
||||
});
|
||||
rewiremock("../../static/js/markdown").with({
|
||||
apply_markdown: noop,
|
||||
});
|
||||
set_global("page_params", {
|
||||
twenty_four_hour_time: false,
|
||||
});
|
||||
|
||||
@@ -8,11 +8,9 @@ const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const noop = () => {};
|
||||
const _ListWidget = {
|
||||
__esModule: true,
|
||||
create: () => ({init: noop}),
|
||||
};
|
||||
rewiremock("../../static/js/list_widget").with(_ListWidget);
|
||||
|
||||
const {DropdownListWidget: dropdown_list_widget} = zrequire("dropdown_list_widget");
|
||||
|
||||
const setup_zjquery_data = (name) => {
|
||||
|
||||
@@ -7,10 +7,8 @@ const MockDate = require("mockdate");
|
||||
const {rewiremock, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const local_message = {__esModule: true};
|
||||
rewiremock("../../static/js/local_message").with(local_message);
|
||||
const markdown = {__esModule: true};
|
||||
rewiremock("../../static/js/markdown").with(markdown);
|
||||
const local_message = rewiremock("../../static/js/local_message").with({});
|
||||
const markdown = rewiremock("../../static/js/markdown").with({});
|
||||
const page_params = set_global("page_params", {});
|
||||
|
||||
const fake_now = 555;
|
||||
@@ -31,6 +29,7 @@ rewiremock("../../static/js/sent_messages").with({
|
||||
|
||||
rewiremock("../../static/js/message_store").with({
|
||||
get: () => ({failed_request: true}),
|
||||
|
||||
update_booleans: () => {},
|
||||
});
|
||||
|
||||
@@ -43,7 +42,6 @@ set_global("home_msg_list", {
|
||||
});
|
||||
|
||||
rewiremock("../../static/js/message_list").with({});
|
||||
|
||||
set_global("current_msg_list", "");
|
||||
|
||||
const echo = zrequire("echo");
|
||||
|
||||
@@ -7,6 +7,7 @@ const {run_test} = require("../zjsunit/test");
|
||||
|
||||
rewiremock("../../static/js/message_scroll").with({
|
||||
hide_loading_older: () => {},
|
||||
|
||||
show_loading_older: () => {},
|
||||
hide_loading_newer: () => {},
|
||||
show_loading_newer: () => {},
|
||||
|
||||
@@ -6,8 +6,7 @@ const {rewiremock, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const message_store = {__esModule: true};
|
||||
rewiremock("../../static/js/message_store").with(message_store);
|
||||
const message_store = rewiremock("../../static/js/message_store").with({});
|
||||
const page_params = set_global("page_params", {});
|
||||
|
||||
const stream_data = zrequire("stream_data");
|
||||
|
||||
@@ -6,7 +6,6 @@ const {rewiremock, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const ui_report = {
|
||||
__esModule: true,
|
||||
displayed_error: false,
|
||||
|
||||
error: () => {
|
||||
|
||||
@@ -19,30 +19,20 @@ rewiremock("../../static/js/search").with({
|
||||
set_global("document", "document-stub");
|
||||
const history = set_global("history", {});
|
||||
|
||||
const admin = {__esModule: true};
|
||||
rewiremock("../../static/js/admin").with(admin);
|
||||
const drafts = {__esModule: true};
|
||||
rewiremock("../../static/js/drafts").with(drafts);
|
||||
set_global("favicon", {});
|
||||
const floating_recipient_bar = {__esModule: true};
|
||||
rewiremock("../../static/js/floating_recipient_bar").with(floating_recipient_bar);
|
||||
const info_overlay = {__esModule: true};
|
||||
rewiremock("../../static/js/info_overlay").with(info_overlay);
|
||||
const message_viewport = {__esModule: true};
|
||||
rewiremock("../../static/js/message_viewport").with(message_viewport);
|
||||
const narrow = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow").with(narrow);
|
||||
const overlays = {__esModule: true};
|
||||
rewiremock("../../static/js/overlays").with(overlays);
|
||||
const settings = {__esModule: true};
|
||||
rewiremock("../../static/js/settings").with(settings);
|
||||
const subs = {__esModule: true};
|
||||
rewiremock("../../static/js/subs").with(subs);
|
||||
const ui_util = {__esModule: true};
|
||||
rewiremock("../../static/js/ui_util").with(ui_util);
|
||||
const admin = rewiremock("../../static/js/admin").with({});
|
||||
const drafts = rewiremock("../../static/js/drafts").with({});
|
||||
const floating_recipient_bar = rewiremock("../../static/js/floating_recipient_bar").with({});
|
||||
const info_overlay = rewiremock("../../static/js/info_overlay").with({});
|
||||
const message_viewport = rewiremock("../../static/js/message_viewport").with({});
|
||||
const narrow = rewiremock("../../static/js/narrow").with({});
|
||||
const overlays = rewiremock("../../static/js/overlays").with({});
|
||||
const settings = rewiremock("../../static/js/settings").with({});
|
||||
const subs = rewiremock("../../static/js/subs").with({});
|
||||
const ui_util = rewiremock("../../static/js/ui_util").with({});
|
||||
rewiremock("../../static/js/top_left_corner").with({
|
||||
handle_narrow_deactivated: () => {},
|
||||
});
|
||||
set_global("favicon", {});
|
||||
|
||||
const people = zrequire("people");
|
||||
const hash_util = zrequire("hash_util");
|
||||
|
||||
@@ -13,7 +13,6 @@ const {make_stub} = require("../zjsunit/stub");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const popovers = {
|
||||
__esModule: true,
|
||||
actions_popped: () => false,
|
||||
message_info_popped: () => false,
|
||||
user_sidebar_popped: () => false,
|
||||
@@ -21,7 +20,6 @@ const popovers = {
|
||||
};
|
||||
rewiremock("../../static/js/popovers").with(popovers);
|
||||
const overlays = {
|
||||
__esModule: true,
|
||||
is_active: () => false,
|
||||
settings_open: () => false,
|
||||
streams_open: () => false,
|
||||
@@ -38,22 +36,22 @@ rewiremock("../../static/js/stream_popover").with({
|
||||
all_messages_popped: () => false,
|
||||
starred_messages_popped: () => false,
|
||||
});
|
||||
|
||||
const emoji_picker = {
|
||||
__esModule: true,
|
||||
reactions_popped: () => false,
|
||||
};
|
||||
rewiremock("../../static/js/emoji_picker").with(emoji_picker);
|
||||
rewiremock("../../static/js/hotspots").with({
|
||||
is_open: () => false,
|
||||
});
|
||||
|
||||
const gear_menu = {
|
||||
__esModule: true,
|
||||
is_open: () => false,
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/gear_menu").with(gear_menu);
|
||||
|
||||
// Important note on these tests:
|
||||
|
||||
//
|
||||
// The way the Zulip hotkey tests work is as follows. First, we set
|
||||
// up various contexts by monkey-patching the various hotkeys exports
|
||||
@@ -79,39 +77,30 @@ const page_params = set_global("page_params", {});
|
||||
// jQuery stuff should go away if we make an initialize() method.
|
||||
set_global("document", "document-stub");
|
||||
|
||||
const compose_actions = {__esModule: true};
|
||||
rewiremock("../../static/js/compose_actions").with(compose_actions);
|
||||
const condense = {__esModule: true};
|
||||
rewiremock("../../static/js/condense").with(condense);
|
||||
const drafts = {__esModule: true};
|
||||
rewiremock("../../static/js/drafts").with(drafts);
|
||||
const compose_actions = rewiremock("../../static/js/compose_actions").with({});
|
||||
const condense = rewiremock("../../static/js/condense").with({});
|
||||
const drafts = rewiremock("../../static/js/drafts").with({});
|
||||
|
||||
const hashchange = {
|
||||
__esModule: true,
|
||||
in_recent_topics_hash: () => false,
|
||||
};
|
||||
const lightbox = rewiremock("../../static/js/lightbox").with({});
|
||||
const list_util = rewiremock("../../static/js/list_util").with({});
|
||||
const message_edit = rewiremock("../../static/js/message_edit").with({});
|
||||
const muting_ui = rewiremock("../../static/js/muting_ui").with({});
|
||||
const narrow = rewiremock("../../static/js/narrow").with({});
|
||||
const navigate = rewiremock("../../static/js/navigate").with({});
|
||||
const reactions = rewiremock("../../static/js/reactions").with({});
|
||||
const search = rewiremock("../../static/js/search").with({});
|
||||
const stream_list = rewiremock("../../static/js/stream_list").with({});
|
||||
rewiremock("../../static/js/hashchange").with(hashchange);
|
||||
const lightbox = {__esModule: true};
|
||||
rewiremock("../../static/js/lightbox").with(lightbox);
|
||||
const list_util = {__esModule: true};
|
||||
rewiremock("../../static/js/list_util").with(list_util);
|
||||
const message_edit = {__esModule: true};
|
||||
rewiremock("../../static/js/message_edit").with(message_edit);
|
||||
const muting_ui = {__esModule: true};
|
||||
rewiremock("../../static/js/muting_ui").with(muting_ui);
|
||||
const narrow = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow").with(narrow);
|
||||
const navigate = {__esModule: true};
|
||||
rewiremock("../../static/js/navigate").with(navigate);
|
||||
const reactions = {__esModule: true};
|
||||
rewiremock("../../static/js/reactions").with(reactions);
|
||||
const search = {__esModule: true};
|
||||
rewiremock("../../static/js/search").with(search);
|
||||
const stream_list = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_list").with(stream_list);
|
||||
const subs = {__esModule: true};
|
||||
|
||||
const subs = {};
|
||||
|
||||
rewiremock("../../static/js/recent_topics").with({
|
||||
is_visible: () => false,
|
||||
});
|
||||
rewiremock("../../static/js/subs").with(subs);
|
||||
|
||||
set_global("current_msg_list", {
|
||||
empty() {
|
||||
return false;
|
||||
@@ -130,9 +119,6 @@ set_global("current_msg_list", {
|
||||
return 101;
|
||||
},
|
||||
});
|
||||
rewiremock("../../static/js/recent_topics").with({
|
||||
is_visible: () => false,
|
||||
});
|
||||
|
||||
const emoji_codes = zrequire("../generated/emoji/emoji_codes.json");
|
||||
const emoji = zrequire("../shared/js/emoji");
|
||||
|
||||
@@ -9,6 +9,7 @@ const $ = require("../zjsunit/zjquery");
|
||||
set_global("Image", class Image {});
|
||||
rewiremock("../../static/js/overlays").with({
|
||||
close_overlay: () => {},
|
||||
|
||||
close_active: () => {},
|
||||
open_overlay: () => {},
|
||||
});
|
||||
@@ -16,10 +17,9 @@ rewiremock("../../static/js/popovers").with({
|
||||
hide_all: () => {},
|
||||
});
|
||||
|
||||
const message_store = {__esModule: true};
|
||||
rewiremock("../../static/js/message_store").with(message_store);
|
||||
|
||||
const message_store = rewiremock("../../static/js/message_store").with({});
|
||||
const rows = zrequire("rows");
|
||||
|
||||
const lightbox = zrequire("lightbox");
|
||||
|
||||
rows.__Rewire__("is_draft_row", () => false);
|
||||
|
||||
@@ -14,11 +14,11 @@ function Element() {
|
||||
return {};
|
||||
}
|
||||
set_global("Element", Element);
|
||||
const ui = {__esModule: true};
|
||||
const ui = {};
|
||||
|
||||
rewiremock("../../static/js/ui").with(ui);
|
||||
|
||||
// We only need very simple jQuery wrappers for when the
|
||||
|
||||
// "real" code wraps html or sets up click handlers.
|
||||
// We'll simulate most other objects ourselves.
|
||||
set_global("$", (arg) => {
|
||||
|
||||
@@ -5,25 +5,20 @@ const {strict: assert} = require("assert");
|
||||
const {rewiremock, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const condense = {__esModule: true};
|
||||
rewiremock("../../static/js/condense").with(condense);
|
||||
set_global("current_msg_list", {});
|
||||
const message_edit = {__esModule: true};
|
||||
rewiremock("../../static/js/message_edit").with(message_edit);
|
||||
const message_list = {__esModule: true};
|
||||
rewiremock("../../static/js/message_list").with(message_list);
|
||||
const notifications = {__esModule: true};
|
||||
rewiremock("../../static/js/notifications").with(notifications);
|
||||
const condense = rewiremock("../../static/js/condense").with({});
|
||||
const message_edit = rewiremock("../../static/js/message_edit").with({});
|
||||
const message_list = rewiremock("../../static/js/message_list").with({});
|
||||
const notifications = rewiremock("../../static/js/notifications").with({});
|
||||
const page_params = set_global("page_params", {});
|
||||
const pm_list = {__esModule: true};
|
||||
rewiremock("../../static/js/pm_list").with(pm_list);
|
||||
const stream_list = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_list").with(stream_list);
|
||||
const unread_ui = {__esModule: true};
|
||||
const pm_list = rewiremock("../../static/js/pm_list").with({});
|
||||
const stream_list = rewiremock("../../static/js/stream_list").with({});
|
||||
set_global("current_msg_list", {});
|
||||
|
||||
const unread_ui = {};
|
||||
|
||||
rewiremock("../../static/js/unread_ui").with(unread_ui);
|
||||
|
||||
const message_events = zrequire("message_events");
|
||||
|
||||
const message_store = zrequire("message_store");
|
||||
const people = zrequire("people");
|
||||
const stream_data = zrequire("stream_data");
|
||||
|
||||
@@ -28,9 +28,11 @@ rewiremock("../../static/js/ui_report").with({
|
||||
hide_error: noop,
|
||||
});
|
||||
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
set_global("document", "document-stub");
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const message_store = rewiremock("../../static/js/message_store").with({});
|
||||
const message_util = rewiremock("../../static/js/message_util").with({});
|
||||
const pm_list = rewiremock("../../static/js/pm_list").with({});
|
||||
const server_events = rewiremock("../../static/js/server_events").with({});
|
||||
rewiremock("../../static/js/message_scroll").with({
|
||||
show_loading_older: noop,
|
||||
hide_loading_older: noop,
|
||||
@@ -38,22 +40,15 @@ rewiremock("../../static/js/message_scroll").with({
|
||||
hide_loading_newer: noop,
|
||||
update_top_of_narrow_notices: () => {},
|
||||
});
|
||||
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 pm_list = {__esModule: true};
|
||||
rewiremock("../../static/js/pm_list").with(pm_list);
|
||||
const server_events = {__esModule: true};
|
||||
rewiremock("../../static/js/server_events").with(server_events);
|
||||
set_global("document", "document-stub");
|
||||
|
||||
const stream_list = {
|
||||
__esModule: true,
|
||||
maybe_scroll_narrow_into_view: () => {},
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/stream_list").with(stream_list);
|
||||
|
||||
const message_fetch = zrequire("message_fetch");
|
||||
|
||||
const {Filter} = zrequire("../js/filter");
|
||||
const message_list = zrequire("message_list");
|
||||
const people = zrequire("people");
|
||||
|
||||
@@ -7,15 +7,14 @@ const {run_test} = require("../zjsunit/test");
|
||||
|
||||
rewiremock("../../static/js/starred_messages").with({
|
||||
add: () => {},
|
||||
|
||||
remove: () => {},
|
||||
});
|
||||
|
||||
const ui = {__esModule: true};
|
||||
rewiremock("../../static/js/ui").with(ui);
|
||||
const channel = {__esModule: true};
|
||||
const ui = rewiremock("../../static/js/ui").with({});
|
||||
const channel = {};
|
||||
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
|
||||
const message_flags = zrequire("message_flags");
|
||||
|
||||
run_test("starred", () => {
|
||||
|
||||
@@ -24,10 +24,8 @@ set_global("document", {
|
||||
},
|
||||
});
|
||||
|
||||
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);
|
||||
const narrow_state = rewiremock("../../static/js/narrow_state").with({});
|
||||
const stream_data = rewiremock("../../static/js/stream_data").with({});
|
||||
|
||||
const muting = zrequire("muting");
|
||||
const {MessageList} = zrequire("message_list");
|
||||
|
||||
@@ -10,10 +10,9 @@ set_global("page_params", {
|
||||
stop_words: ["what", "about"],
|
||||
});
|
||||
|
||||
const stream_topic_history = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_topic_history").with(stream_topic_history);
|
||||
|
||||
const stream_topic_history = rewiremock("../../static/js/stream_topic_history").with({});
|
||||
const hash_util = zrequire("hash_util");
|
||||
|
||||
const compose_state = zrequire("compose_state");
|
||||
const narrow_state = zrequire("narrow_state");
|
||||
const people = zrequire("people");
|
||||
|
||||
@@ -9,49 +9,34 @@ rewiremock("../../static/js/resize").with({
|
||||
resize_stream_filters_container: () => {},
|
||||
});
|
||||
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const compose = {__esModule: true};
|
||||
rewiremock("../../static/js/compose").with(compose);
|
||||
const compose_actions = {__esModule: true};
|
||||
rewiremock("../../static/js/compose_actions").with(compose_actions);
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const compose = rewiremock("../../static/js/compose").with({});
|
||||
const compose_actions = rewiremock("../../static/js/compose_actions").with({});
|
||||
const hashchange = rewiremock("../../static/js/hashchange").with({});
|
||||
const message_fetch = rewiremock("../../static/js/message_fetch").with({});
|
||||
set_global("current_msg_list", {});
|
||||
const hashchange = {__esModule: true};
|
||||
rewiremock("../../static/js/hashchange").with(hashchange);
|
||||
set_global("home_msg_list", {});
|
||||
const message_fetch = {__esModule: true};
|
||||
rewiremock("../../static/js/message_fetch").with(message_fetch);
|
||||
const message_list = {
|
||||
__esModule: true,
|
||||
|
||||
const message_list = {
|
||||
set_narrowed(value) {
|
||||
message_list.narrowed = value;
|
||||
},
|
||||
};
|
||||
const message_scroll = rewiremock("../../static/js/message_scroll").with({});
|
||||
const message_view_header = rewiremock("../../static/js/message_view_header").with({});
|
||||
const notifications = rewiremock("../../static/js/notifications").with({});
|
||||
const search = rewiremock("../../static/js/search").with({});
|
||||
const stream_list = rewiremock("../../static/js/stream_list").with({});
|
||||
const top_left_corner = rewiremock("../../static/js/top_left_corner").with({});
|
||||
const typing_events = rewiremock("../../static/js/typing_events").with({});
|
||||
const ui_util = rewiremock("../../static/js/ui_util").with({});
|
||||
const unread_ops = rewiremock("../../static/js/unread_ops").with({});
|
||||
rewiremock("../../static/js/message_list").with(message_list);
|
||||
const message_scroll = {__esModule: true};
|
||||
rewiremock("../../static/js/message_scroll").with(message_scroll);
|
||||
const notifications = {__esModule: true};
|
||||
rewiremock("../../static/js/notifications").with(notifications);
|
||||
set_global("page_params", {});
|
||||
const search = {__esModule: true};
|
||||
rewiremock("../../static/js/search").with(search);
|
||||
const stream_list = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_list").with(stream_list);
|
||||
const message_view_header = {__esModule: true};
|
||||
rewiremock("../../static/js/message_view_header").with(message_view_header);
|
||||
const top_left_corner = {__esModule: true};
|
||||
rewiremock("../../static/js/top_left_corner").with(top_left_corner);
|
||||
const typing_events = {__esModule: true};
|
||||
rewiremock("../../static/js/typing_events").with(typing_events);
|
||||
const ui_util = {__esModule: true};
|
||||
rewiremock("../../static/js/ui_util").with(ui_util);
|
||||
const unread_ops = {__esModule: true};
|
||||
rewiremock("../../static/js/unread_ops").with(unread_ops);
|
||||
rewiremock("../../static/js/recent_topics").with({
|
||||
hide: () => {},
|
||||
is_visible: () => {},
|
||||
});
|
||||
set_global("page_params", {});
|
||||
|
||||
//
|
||||
// We have strange hacks in narrow.activate to sleep 0
|
||||
|
||||
@@ -5,11 +5,11 @@ const {strict: assert} = require("assert");
|
||||
const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const message_list = {__esModule: true};
|
||||
const message_list = {};
|
||||
|
||||
rewiremock("../../static/js/message_list").with(message_list);
|
||||
|
||||
const {Filter} = zrequire("../js/filter");
|
||||
|
||||
const {MessageListData} = zrequire("../js/message_list_data");
|
||||
const narrow_state = zrequire("narrow_state");
|
||||
const narrow = zrequire("narrow");
|
||||
|
||||
@@ -5,13 +5,11 @@ const {strict: assert} = require("assert");
|
||||
const {rewiremock, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const message_store = {__esModule: true};
|
||||
rewiremock("../../static/js/message_store").with(message_store);
|
||||
set_global("page_params", {});
|
||||
|
||||
const message_store = rewiremock("../../static/js/message_store").with({});
|
||||
rewiremock("../../static/js/muting").with({
|
||||
is_topic_muted: () => false,
|
||||
});
|
||||
set_global("page_params", {});
|
||||
|
||||
const {Filter} = zrequire("../js/filter");
|
||||
const people = zrequire("people");
|
||||
|
||||
@@ -9,8 +9,7 @@ const MockDate = require("mockdate");
|
||||
const {rewiremock, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const message_store = {__esModule: true};
|
||||
rewiremock("../../static/js/message_store").with(message_store);
|
||||
const message_store = rewiremock("../../static/js/message_store").with({});
|
||||
const page_params = set_global("page_params", {});
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
@@ -6,12 +6,10 @@ const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const reload_state = {
|
||||
__esModule: true,
|
||||
is_in_progress: () => false,
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/reload_state").with(reload_state);
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
const me = {
|
||||
|
||||
@@ -6,28 +6,25 @@ const {rewiremock, with_field, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const narrow_state = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow_state").with(narrow_state);
|
||||
rewiremock("../../static/js/ui").with({
|
||||
get_content_element: (element) => element,
|
||||
});
|
||||
const narrow_state = rewiremock("../../static/js/narrow_state").with({});
|
||||
const unread = rewiremock("../../static/js/unread").with({});
|
||||
const unread_ui = rewiremock("../../static/js/unread_ui").with({});
|
||||
rewiremock("../../static/js/stream_popover").with({
|
||||
hide_topic_popover() {},
|
||||
});
|
||||
const unread = {__esModule: true};
|
||||
rewiremock("../../static/js/unread").with(unread);
|
||||
const unread_ui = {__esModule: true};
|
||||
rewiremock("../../static/js/unread_ui").with(unread_ui);
|
||||
rewiremock("../../static/js/ui").with({
|
||||
get_content_element: (element) => element,
|
||||
});
|
||||
|
||||
const vdom = {
|
||||
__esModule: true,
|
||||
render: () => "fake-dom-for-pm-list",
|
||||
};
|
||||
rewiremock("../../static/js/vdom").with(vdom);
|
||||
const pm_list_dom = {__esModule: true};
|
||||
const pm_list_dom = {};
|
||||
|
||||
rewiremock("../../static/js/pm_list_dom").with(pm_list_dom);
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
const pm_conversations = zrequire("pm_conversations");
|
||||
const pm_list = zrequire("pm_list");
|
||||
|
||||
|
||||
@@ -15,18 +15,15 @@ set_global("page_params", {
|
||||
realm_email_address_visibility: 3,
|
||||
custom_profile_fields: [],
|
||||
});
|
||||
const rows = {__esModule: true};
|
||||
|
||||
rewiremock("../../static/js/rows").with(rows);
|
||||
|
||||
rewiremock("../../static/js/message_viewport").with({
|
||||
height: () => 500,
|
||||
});
|
||||
const rows = {};
|
||||
|
||||
rewiremock("../../static/js/emoji_picker").with({
|
||||
hide_emoji_popover: noop,
|
||||
});
|
||||
|
||||
rewiremock("../../static/js/message_viewport").with({
|
||||
height: () => 500,
|
||||
});
|
||||
rewiremock("../../static/js/rows").with(rows);
|
||||
rewiremock("../../static/js/stream_popover").with({
|
||||
hide_stream_popover: noop,
|
||||
hide_topic_popover: noop,
|
||||
@@ -35,11 +32,11 @@ rewiremock("../../static/js/stream_popover").with({
|
||||
hide_streamlist_sidebar: noop,
|
||||
});
|
||||
|
||||
const stream_data = {__esModule: true};
|
||||
const stream_data = {};
|
||||
|
||||
rewiremock("../../static/js/stream_data").with(stream_data);
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
const user_status = zrequire("user_status");
|
||||
const message_edit = zrequire("message_edit");
|
||||
|
||||
|
||||
@@ -5,16 +5,14 @@ const {strict: assert} = require("assert");
|
||||
const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const server_events = {__esModule: true};
|
||||
rewiremock("../../static/js/server_events").with(server_events);
|
||||
const server_events = rewiremock("../../static/js/server_events").with({});
|
||||
const reload_state = {
|
||||
__esModule: true,
|
||||
is_in_progress: () => false,
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/reload_state").with(reload_state);
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
const presence = zrequire("presence");
|
||||
|
||||
const OFFLINE_THRESHOLD_SECS = 140;
|
||||
|
||||
@@ -15,15 +15,12 @@ set_global("page_params", {
|
||||
user_id: alice_user_id,
|
||||
});
|
||||
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const emoji_picker = {
|
||||
__esModule: true,
|
||||
hide_emoji_popover() {},
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/emoji_picker").with(emoji_picker);
|
||||
|
||||
const message = {
|
||||
id: 1001,
|
||||
reactions: [
|
||||
@@ -56,8 +53,6 @@ const message = {
|
||||
};
|
||||
|
||||
const message_store = {
|
||||
__esModule: true,
|
||||
|
||||
get(message_id) {
|
||||
assert.equal(message_id, 1001);
|
||||
return message;
|
||||
@@ -65,7 +60,6 @@ const message_store = {
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/message_store").with(message_store);
|
||||
|
||||
set_global("current_msg_list", {
|
||||
selected_message() {
|
||||
return {sent_by_me: true};
|
||||
|
||||
@@ -12,8 +12,6 @@ rewiremock("../../static/js/message_store").with({
|
||||
get: (msg_id) => messages[msg_id - 1],
|
||||
});
|
||||
const message_list = {
|
||||
__esModule: true,
|
||||
|
||||
all: {
|
||||
all_messages() {
|
||||
return messages;
|
||||
@@ -22,8 +20,8 @@ const message_list = {
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/message_list").with(message_list);
|
||||
|
||||
const rs = zrequire("recent_senders");
|
||||
|
||||
zrequire("message_util.js");
|
||||
|
||||
run_test("process_message_for_senders", (override) => {
|
||||
|
||||
@@ -26,6 +26,7 @@ rewiremock("../../static/js/message_view_header").with({
|
||||
|
||||
rewiremock("../../static/js/timerender").with({
|
||||
last_seen_status_from_date: () => "Just now",
|
||||
|
||||
get_full_datetime: () => ({
|
||||
date: "date",
|
||||
time: "time",
|
||||
@@ -44,13 +45,13 @@ rewiremock("../../static/js/unread").with({
|
||||
});
|
||||
rewiremock("../../static/js/hash_util").with({
|
||||
by_stream_uri: () => "https://www.example.com",
|
||||
|
||||
by_stream_topic_uri: () => "https://www.example.com",
|
||||
});
|
||||
rewiremock("../../static/js/recent_senders").with({
|
||||
get_topic_recent_senders: () => [1, 2],
|
||||
});
|
||||
const ListWidget = {
|
||||
__esModule: true,
|
||||
modifier: noop,
|
||||
|
||||
create: (container, mapped_topic_values, opts) => {
|
||||
@@ -76,10 +77,10 @@ const ListWidget = {
|
||||
hard_redraw: noop,
|
||||
render_item: (item) => ListWidget.modifier(item),
|
||||
};
|
||||
rewiremock("../../static/js/list_widget").with(ListWidget);
|
||||
rewiremock("../../static/js/drafts").with({
|
||||
update_draft: noop,
|
||||
});
|
||||
rewiremock("../../static/js/list_widget").with(ListWidget);
|
||||
|
||||
const ls_container = new Map();
|
||||
set_global("localStorage", {
|
||||
@@ -135,8 +136,6 @@ const sender2 = 2;
|
||||
const messages = [];
|
||||
|
||||
const message_list = {
|
||||
__esModule: true,
|
||||
|
||||
all: {
|
||||
all_messages() {
|
||||
return messages;
|
||||
|
||||
@@ -13,24 +13,20 @@ set_global("page_params", {
|
||||
const noop = () => {};
|
||||
|
||||
const narrow_state = {
|
||||
__esModule: true,
|
||||
filter: () => false,
|
||||
};
|
||||
const narrow = rewiremock("../../static/js/narrow").with({});
|
||||
const search_suggestion = rewiremock("../../static/js/search_suggestion").with({});
|
||||
rewiremock("../../static/js/narrow_state").with(narrow_state);
|
||||
const search_suggestion = {__esModule: true};
|
||||
rewiremock("../../static/js/search_suggestion").with(search_suggestion);
|
||||
rewiremock("../../static/js/ui_util").with({
|
||||
change_tab_to: noop,
|
||||
place_caret_at_end: noop,
|
||||
});
|
||||
const narrow = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow").with(narrow);
|
||||
rewiremock("../../static/js/search_pill_widget").with({
|
||||
widget: {
|
||||
getByID: () => true,
|
||||
},
|
||||
});
|
||||
|
||||
rewiremock("../../static/js/ui_util").with({
|
||||
change_tab_to: noop,
|
||||
place_caret_at_end: noop,
|
||||
});
|
||||
set_global("setTimeout", (func) => func());
|
||||
|
||||
const search = zrequire("search");
|
||||
|
||||
@@ -12,15 +12,13 @@ set_global("page_params", {
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
const narrow_state = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow_state").with(narrow_state);
|
||||
const search_suggestion = {__esModule: true};
|
||||
rewiremock("../../static/js/search_suggestion").with(search_suggestion);
|
||||
const narrow = rewiremock("../../static/js/narrow").with({});
|
||||
const narrow_state = rewiremock("../../static/js/narrow_state").with({});
|
||||
const search_suggestion = rewiremock("../../static/js/search_suggestion").with({});
|
||||
rewiremock("../../static/js/ui_util").with({
|
||||
change_tab_to: noop,
|
||||
});
|
||||
const narrow = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow").with(narrow);
|
||||
|
||||
const Filter = {};
|
||||
|
||||
rewiremock("../../static/js/filter").with({
|
||||
|
||||
@@ -16,8 +16,12 @@ set_global("document", {
|
||||
});
|
||||
set_global("addEventListener", noop);
|
||||
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
rewiremock("../../static/js/reload_state").with({
|
||||
is_in_progress() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
set_global("home_msg_list", {
|
||||
select_id: noop,
|
||||
selected_id() {
|
||||
@@ -25,11 +29,6 @@ set_global("home_msg_list", {
|
||||
},
|
||||
});
|
||||
set_global("page_params", {test_suite: false});
|
||||
rewiremock("../../static/js/reload_state").with({
|
||||
is_in_progress() {
|
||||
return false;
|
||||
},
|
||||
});
|
||||
|
||||
// we also directly write to pointer
|
||||
set_global("pointer", {});
|
||||
@@ -50,7 +49,6 @@ rewiremock("../../static/js/stream_events").with({
|
||||
});
|
||||
|
||||
const message_events = rewiremock("../../static/js/message_events").with({
|
||||
__esModule: true,
|
||||
insert_new_messages() {
|
||||
throw new Error("insert error");
|
||||
},
|
||||
|
||||
@@ -27,9 +27,7 @@ const bot_data_params = {
|
||||
],
|
||||
};
|
||||
|
||||
const avatar = {__esModule: true};
|
||||
rewiremock("../../static/js/avatar").with(avatar);
|
||||
|
||||
const avatar = rewiremock("../../static/js/avatar").with({});
|
||||
function ClipboardJS(sel) {
|
||||
assert.equal(sel, "#copy_zuliprc");
|
||||
}
|
||||
|
||||
@@ -6,8 +6,7 @@ const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const upload_widget = {__esModule: true};
|
||||
rewiremock("../../static/js/upload_widget").with(upload_widget);
|
||||
const upload_widget = rewiremock("../../static/js/upload_widget").with({});
|
||||
const settings_emoji = zrequire("settings_emoji");
|
||||
|
||||
run_test("build_emoji_upload_widget", () => {
|
||||
|
||||
@@ -6,11 +6,11 @@ const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const muting_ui = {__esModule: true};
|
||||
const muting_ui = {};
|
||||
|
||||
rewiremock("../../static/js/muting_ui").with(muting_ui);
|
||||
|
||||
const settings_muting = zrequire("settings_muting");
|
||||
|
||||
const stream_data = zrequire("stream_data");
|
||||
const muting = zrequire("muting");
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ const _FormData = function () {
|
||||
};
|
||||
|
||||
const _loading = {
|
||||
__esModule: true,
|
||||
make_indicator: noop,
|
||||
destroy_indicator: noop,
|
||||
};
|
||||
@@ -38,12 +37,10 @@ const page_params = set_global("page_params", {
|
||||
realm_authentication_methods: {},
|
||||
});
|
||||
|
||||
const realm_icon = {__esModule: true};
|
||||
rewiremock("../../static/js/realm_icon").with(realm_icon);
|
||||
const channel = {__esModule: true};
|
||||
const realm_icon = rewiremock("../../static/js/realm_icon").with({});
|
||||
const channel = {};
|
||||
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
|
||||
stub_templates((name, data) => {
|
||||
if (name === "settings/admin_realm_domains_list") {
|
||||
assert(data.realm_domain.domain);
|
||||
@@ -52,13 +49,10 @@ stub_templates((name, data) => {
|
||||
throw new Error(`Unknown template ${name}`);
|
||||
});
|
||||
|
||||
const overlays = {__esModule: true};
|
||||
const overlays = {};
|
||||
|
||||
rewiremock("../../static/js/overlays").with(overlays);
|
||||
|
||||
const _ui_report = {
|
||||
__esModule: true,
|
||||
|
||||
success(msg, elem) {
|
||||
elem.val(msg);
|
||||
},
|
||||
@@ -69,16 +63,15 @@ const _ui_report = {
|
||||
};
|
||||
|
||||
const _ListWidget = {
|
||||
__esModule: true,
|
||||
create: () => ({init: noop}),
|
||||
};
|
||||
|
||||
set_global("csrf_token", "token-stub");
|
||||
set_global("FormData", _FormData);
|
||||
set_global("jQuery", _jQuery);
|
||||
rewiremock("../../static/js/list_widget").with(_ListWidget);
|
||||
rewiremock("../../static/js/loading").with(_loading);
|
||||
rewiremock("../../static/js/ui_report").with(_ui_report);
|
||||
rewiremock("../../static/js/list_widget").with(_ListWidget);
|
||||
|
||||
const settings_config = zrequire("settings_config");
|
||||
const settings_bots = zrequire("settings_bots");
|
||||
|
||||
@@ -8,11 +8,11 @@ const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const page_params = set_global("page_params", {});
|
||||
const loading = {__esModule: true};
|
||||
const loading = {};
|
||||
|
||||
rewiremock("../../static/js/loading").with(loading);
|
||||
|
||||
const SHORT_TEXT_ID = 1;
|
||||
|
||||
const CHOICE_ID = 3;
|
||||
const EXTERNAL_ACCOUNT_ID = 7;
|
||||
|
||||
|
||||
@@ -9,10 +9,9 @@ const {rewiremock, set_global, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const confirm_dialog = {__esModule: true};
|
||||
const confirm_dialog = {};
|
||||
|
||||
rewiremock("../../static/js/confirm_dialog").with(confirm_dialog);
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
const pills = {
|
||||
@@ -21,27 +20,25 @@ const pills = {
|
||||
|
||||
let create_item_handler;
|
||||
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const typeahead_helper = {__esModule: true};
|
||||
rewiremock("../../static/js/typeahead_helper").with(typeahead_helper);
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const typeahead_helper = rewiremock("../../static/js/typeahead_helper").with({});
|
||||
|
||||
const user_groups = {
|
||||
__esModule: true,
|
||||
get_user_group_from_id: noop,
|
||||
remove: noop,
|
||||
add: noop,
|
||||
};
|
||||
rewiremock("../../static/js/user_groups").with(user_groups);
|
||||
const ui_report = {__esModule: true};
|
||||
|
||||
rewiremock("../../static/js/ui_report").with(ui_report);
|
||||
const ui_report = {};
|
||||
|
||||
const page_params = set_global("page_params", {});
|
||||
const input_pill = {__esModule: true};
|
||||
rewiremock("../../static/js/ui_report").with(ui_report);
|
||||
|
||||
const input_pill = {};
|
||||
|
||||
rewiremock("../../static/js/input_pill").with(input_pill);
|
||||
|
||||
const user_pill = zrequire("user_pill");
|
||||
|
||||
const settings_user_groups = zrequire("settings_user_groups");
|
||||
const settings_config = zrequire("settings_config");
|
||||
const people = zrequire("people");
|
||||
|
||||
@@ -10,31 +10,30 @@ const $ = require("../zjsunit/zjquery");
|
||||
const noop = () => {};
|
||||
stub_templates(() => noop);
|
||||
|
||||
rewiremock("../../static/js/hashchange").with({update_browser_history: noop});
|
||||
const page_params = set_global("page_params", {});
|
||||
const typeahead_helper = rewiremock("../../static/js/typeahead_helper").with({});
|
||||
rewiremock("../../static/js/hash_util").with({
|
||||
stream_edit_uri: noop,
|
||||
by_stream_uri: noop,
|
||||
});
|
||||
rewiremock("../../static/js/hashchange").with({update_browser_history: noop});
|
||||
rewiremock("../../static/js/list_widget").with({
|
||||
create: () => ({init: noop}),
|
||||
});
|
||||
const page_params = set_global("page_params", {});
|
||||
rewiremock("../../static/js/settings_notifications").with({
|
||||
get_notifications_table_row_data: noop,
|
||||
});
|
||||
rewiremock("../../static/js/stream_color").with({
|
||||
set_colorpicker_color: noop,
|
||||
});
|
||||
const typeahead_helper = {__esModule: true};
|
||||
rewiremock("../../static/js/typeahead_helper").with(typeahead_helper);
|
||||
|
||||
const ui = {
|
||||
__esModule: true,
|
||||
get_scroll_element: noop,
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/ui").with(ui);
|
||||
|
||||
const peer_data = zrequire("peer_data");
|
||||
|
||||
const people = zrequire("people");
|
||||
const stream_edit = zrequire("stream_edit");
|
||||
const stream_data = zrequire("stream_data");
|
||||
|
||||
@@ -9,26 +9,13 @@ const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const noop = () => {};
|
||||
const _settings_notifications = {
|
||||
__esModule: true,
|
||||
update_page: () => {},
|
||||
};
|
||||
rewiremock("../../static/js/settings_notifications").with(_settings_notifications);
|
||||
|
||||
const color_data = {__esModule: true};
|
||||
rewiremock("../../static/js/color_data").with(color_data);
|
||||
set_global("current_msg_list", {});
|
||||
const message_util = {__esModule: true};
|
||||
rewiremock("../../static/js/message_util").with(message_util);
|
||||
const stream_color = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_color").with(stream_color);
|
||||
const stream_list = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_list").with(stream_list);
|
||||
const stream_muting = {__esModule: true};
|
||||
rewiremock("../../static/js/stream_muting").with(stream_muting);
|
||||
rewiremock("../../static/js/recent_topics").with({
|
||||
complete_rerender: () => {},
|
||||
});
|
||||
|
||||
const color_data = rewiremock("../../static/js/color_data").with({});
|
||||
const message_util = rewiremock("../../static/js/message_util").with({});
|
||||
const stream_color = rewiremock("../../static/js/stream_color").with({});
|
||||
const stream_list = rewiremock("../../static/js/stream_list").with({});
|
||||
const stream_muting = rewiremock("../../static/js/stream_muting").with({});
|
||||
rewiremock("../../static/js/message_list").with({
|
||||
all: {
|
||||
all_messages() {
|
||||
@@ -36,13 +23,17 @@ rewiremock("../../static/js/message_list").with({
|
||||
},
|
||||
},
|
||||
});
|
||||
rewiremock("../../static/js/recent_topics").with({
|
||||
complete_rerender: () => {},
|
||||
});
|
||||
rewiremock("../../static/js/settings_notifications").with(_settings_notifications);
|
||||
set_global("current_msg_list", {});
|
||||
|
||||
const subs = {
|
||||
__esModule: true,
|
||||
update_settings_for_subscribed: noop,
|
||||
};
|
||||
rewiremock("../../static/js/subs").with(subs);
|
||||
rewiremock("../../static/js/overlays").with({streams_open: () => true});
|
||||
rewiremock("../../static/js/subs").with(subs);
|
||||
|
||||
const peer_data = zrequire("peer_data");
|
||||
const people = zrequire("people");
|
||||
|
||||
@@ -16,17 +16,13 @@ const page_params = set_global("page_params", {
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
const topic_list = {__esModule: true};
|
||||
rewiremock("../../static/js/topic_list").with(topic_list);
|
||||
|
||||
const narrow_state = rewiremock("../../static/js/narrow_state").with({});
|
||||
const topic_list = rewiremock("../../static/js/topic_list").with({});
|
||||
rewiremock("../../static/js/keydown_util").with({
|
||||
handle: noop,
|
||||
});
|
||||
|
||||
rewiremock("../../static/js/ui").with({get_scroll_element: (element) => element});
|
||||
|
||||
const narrow_state = rewiremock("../../static/js/narrow_state").with({__esModule: true});
|
||||
|
||||
const {Filter} = zrequire("../js/filter");
|
||||
const stream_sort = zrequire("stream_sort");
|
||||
const stream_color = zrequire("stream_color");
|
||||
|
||||
@@ -13,15 +13,14 @@ const noop = () => {};
|
||||
|
||||
rewiremock("../../static/js/resize").with({
|
||||
resize_page_components: noop,
|
||||
|
||||
resize_stream_filters_container: noop,
|
||||
});
|
||||
|
||||
const popovers = {__esModule: true};
|
||||
rewiremock("../../static/js/popovers").with(popovers);
|
||||
const stream_popover = {__esModule: true};
|
||||
const popovers = rewiremock("../../static/js/popovers").with({});
|
||||
const stream_popover = {};
|
||||
|
||||
rewiremock("../../static/js/stream_popover").with(stream_popover);
|
||||
|
||||
const stream_list = zrequire("stream_list");
|
||||
|
||||
function expand_sidebar() {
|
||||
|
||||
@@ -5,12 +5,9 @@ const {strict: assert} = require("assert");
|
||||
const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const message_list = {__esModule: true};
|
||||
rewiremock("../../static/js/message_list").with(message_list);
|
||||
const message_util = {__esModule: true};
|
||||
rewiremock("../../static/js/message_util").with(message_util);
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const message_list = rewiremock("../../static/js/message_list").with({});
|
||||
const message_util = rewiremock("../../static/js/message_util").with({});
|
||||
|
||||
const unread = zrequire("unread");
|
||||
const stream_data = zrequire("stream_data");
|
||||
|
||||
@@ -5,14 +5,12 @@ const {strict: assert} = require("assert");
|
||||
const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const widgetize = {__esModule: true};
|
||||
rewiremock("../../static/js/widgetize").with(widgetize);
|
||||
const message_store = {__esModule: true};
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const widgetize = rewiremock("../../static/js/widgetize").with({});
|
||||
|
||||
const message_store = {};
|
||||
|
||||
rewiremock("../../static/js/message_store").with(message_store);
|
||||
|
||||
const submessage = zrequire("submessage");
|
||||
|
||||
run_test("get_message_events", () => {
|
||||
|
||||
@@ -8,7 +8,6 @@ const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const ui = {
|
||||
__esModule: true,
|
||||
get_content_element: (element) => element,
|
||||
get_scroll_element: (element) => element,
|
||||
};
|
||||
|
||||
@@ -8,20 +8,17 @@ const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const narrow_state = {
|
||||
__esModule: true,
|
||||
topic() {},
|
||||
};
|
||||
rewiremock("../../static/js/narrow_state").with(narrow_state);
|
||||
const muting = {
|
||||
__esModule: true,
|
||||
|
||||
is_topic_muted() {
|
||||
return false;
|
||||
},
|
||||
};
|
||||
rewiremock("../../static/js/muting").with(muting);
|
||||
|
||||
const stream_data = zrequire("stream_data");
|
||||
|
||||
const unread = zrequire("unread");
|
||||
const stream_topic_history = zrequire("stream_topic_history");
|
||||
const topic_list_data = zrequire("topic_list_data");
|
||||
|
||||
@@ -8,21 +8,18 @@ const {run_test} = require("../zjsunit/test");
|
||||
const noop = () => {};
|
||||
|
||||
const page_params = set_global("page_params", {});
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const reload = {__esModule: true};
|
||||
rewiremock("../../static/js/reload").with(reload);
|
||||
const reload_state = {__esModule: true};
|
||||
rewiremock("../../static/js/reload_state").with(reload_state);
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const reload = rewiremock("../../static/js/reload").with({});
|
||||
const reload_state = rewiremock("../../static/js/reload_state").with({});
|
||||
|
||||
const sent_messages = {
|
||||
__esModule: true,
|
||||
start_tracking_message: noop,
|
||||
report_server_ack: noop,
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/sent_messages").with(sent_messages);
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
const transmit = zrequire("transmit");
|
||||
|
||||
run_test("transmit_message_ajax", () => {
|
||||
|
||||
@@ -19,40 +19,31 @@ const {run_test} = require("../zjsunit/test");
|
||||
|
||||
set_global("page_params", {});
|
||||
|
||||
const activity = {__esModule: true};
|
||||
rewiremock("../../static/js/activity").with(activity);
|
||||
const message_live_update = {__esModule: true};
|
||||
rewiremock("../../static/js/message_live_update").with(message_live_update);
|
||||
const pm_list = {__esModule: true};
|
||||
rewiremock("../../static/js/pm_list").with(pm_list);
|
||||
const settings_users = {__esModule: true};
|
||||
rewiremock("../../static/js/settings_users").with(settings_users);
|
||||
const activity = rewiremock("../../static/js/activity").with({});
|
||||
const home_msg_list = set_global("home_msg_list", {});
|
||||
const message_list = {__esModule: true};
|
||||
rewiremock("../../static/js/message_list").with(message_list);
|
||||
const message_util = {__esModule: true};
|
||||
rewiremock("../../static/js/message_util").with(message_util);
|
||||
const notifications = {__esModule: true};
|
||||
rewiremock("../../static/js/notifications").with(notifications);
|
||||
const overlays = {__esModule: true};
|
||||
rewiremock("../../static/js/overlays").with(overlays);
|
||||
const resize = {__esModule: true};
|
||||
rewiremock("../../static/js/resize").with(resize);
|
||||
let stream_list = {__esModule: true};
|
||||
const message_list = rewiremock("../../static/js/message_list").with({});
|
||||
const message_live_update = rewiremock("../../static/js/message_live_update").with({});
|
||||
const message_util = rewiremock("../../static/js/message_util").with({});
|
||||
const notifications = rewiremock("../../static/js/notifications").with({});
|
||||
const overlays = rewiremock("../../static/js/overlays").with({});
|
||||
const pm_list = rewiremock("../../static/js/pm_list").with({});
|
||||
const resize = rewiremock("../../static/js/resize").with({});
|
||||
const settings_users = rewiremock("../../static/js/settings_users").with({});
|
||||
|
||||
let stream_list = {};
|
||||
rewiremock("../../static/js/stream_list").with(stream_list);
|
||||
let unread_ops = {__esModule: true};
|
||||
let unread_ops = {};
|
||||
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const message_viewport = rewiremock("../../static/js/message_viewport").with({});
|
||||
const unread_ui = rewiremock("../../static/js/unread_ui").with({});
|
||||
rewiremock("../../static/js/unread_ops").with(unread_ops);
|
||||
const unread_ui = {__esModule: true};
|
||||
rewiremock("../../static/js/unread_ui").with(unread_ui);
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const message_viewport = {__esModule: true};
|
||||
rewiremock("../../static/js/message_viewport").with(message_viewport);
|
||||
const topic_list = {__esModule: true};
|
||||
|
||||
const topic_list = {};
|
||||
|
||||
rewiremock("../../static/js/topic_list").with(topic_list);
|
||||
|
||||
// Let's start with testing a function from util.js.
|
||||
|
||||
//
|
||||
// We will use our special zrequire helper to import the
|
||||
// code from util. We use zrequire instead of require,
|
||||
|
||||
@@ -13,11 +13,11 @@ let page_params = set_global("page_params", {
|
||||
|
||||
set_global("current_msg_list", {});
|
||||
set_global("home_msg_list", {});
|
||||
const message_store = {__esModule: true};
|
||||
const message_store = {};
|
||||
|
||||
rewiremock("../../static/js/message_store").with(message_store);
|
||||
|
||||
const muting = zrequire("muting");
|
||||
|
||||
const people = zrequire("people");
|
||||
const stream_data = zrequire("stream_data");
|
||||
const unread = zrequire("unread");
|
||||
|
||||
@@ -45,18 +45,16 @@ rewiremock("../../static/js/compose").with({
|
||||
});
|
||||
|
||||
const settings_account = {
|
||||
__esModule: true,
|
||||
update_email() {},
|
||||
update_full_name() {},
|
||||
};
|
||||
|
||||
rewiremock("../../static/js/settings_account").with(settings_account);
|
||||
|
||||
const message_live_update = {__esModule: true};
|
||||
const message_live_update = {};
|
||||
|
||||
rewiremock("../../static/js/message_live_update").with(message_live_update);
|
||||
|
||||
const people = zrequire("people");
|
||||
|
||||
const settings_config = zrequire("settings_config");
|
||||
const user_events = zrequire("user_events");
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ const {strict: assert} = require("assert");
|
||||
const {rewiremock, zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
|
||||
const channel = {__esModule: true};
|
||||
rewiremock("../../static/js/channel").with(channel);
|
||||
const channel = rewiremock("../../static/js/channel").with({});
|
||||
const user_status = zrequire("user_status");
|
||||
|
||||
function initialize() {
|
||||
|
||||
@@ -52,8 +52,7 @@ rewiremock("../../static/js/poll_widget").with({
|
||||
});
|
||||
set_global("document", "document-stub");
|
||||
|
||||
const narrow_state = {__esModule: true};
|
||||
rewiremock("../../static/js/narrow_state").with(narrow_state);
|
||||
const narrow_state = rewiremock("../../static/js/narrow_state").with({});
|
||||
set_global("current_msg_list", {});
|
||||
|
||||
const widgetize = zrequire("widgetize");
|
||||
|
||||
@@ -37,6 +37,7 @@ exports.rewiremock = (fn) => {
|
||||
Or call this earlier.
|
||||
`);
|
||||
}
|
||||
obj.__esModule = true;
|
||||
mock_paths[long_fn] = obj;
|
||||
mock_names.add(short_fn);
|
||||
return obj;
|
||||
|
||||
Reference in New Issue
Block a user