mirror of https://github.com/zulip/zulip.git
tests: Unmock user_settings.
We previously auto-mocked this out of expediency, but that made it impossible to test anything that uses the Zod schemata in the same module. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
4d74ecccf3
commit
8e49ca163b
|
@ -289,7 +289,6 @@ EXEMPT_FILES = make_set(
|
|||
"web/src/user_groups.ts",
|
||||
"web/src/user_pill.ts",
|
||||
"web/src/user_profile.ts",
|
||||
"web/src/user_settings.ts",
|
||||
"web/src/user_sort.ts",
|
||||
"web/src/user_status.ts",
|
||||
"web/src/user_status_ui.ts",
|
||||
|
|
|
@ -13,7 +13,7 @@ const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespac
|
|||
const {run_test, noop} = require("./lib/test");
|
||||
const blueslip = require("./lib/zblueslip");
|
||||
const $ = require("./lib/zjquery");
|
||||
const {current_user, page_params, realm, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, page_params, realm} = require("./lib/zpage_params");
|
||||
|
||||
const $window_stub = $.create("window-stub");
|
||||
set_global("to_$", () => $window_stub);
|
||||
|
@ -52,6 +52,10 @@ const peer_data = zrequire("peer_data");
|
|||
const message_lists = zrequire("message_lists");
|
||||
const util = zrequire("util");
|
||||
const {Filter} = zrequire("../src/filter");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const me = {
|
||||
email: "me@zulip.com",
|
||||
|
|
|
@ -6,11 +6,14 @@ const {zrequire} = require("./lib/namespace");
|
|||
const {make_stub} = require("./lib/stub");
|
||||
const {run_test} = require("./lib/test");
|
||||
const blueslip = require("./lib/zblueslip");
|
||||
const {user_settings} = require("./lib/zpage_params");
|
||||
|
||||
window.location.hash = "#bogus";
|
||||
|
||||
const browser_history = zrequire("browser_history");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
function test(label, f) {
|
||||
run_test(label, (helpers) => {
|
||||
|
|
|
@ -6,7 +6,7 @@ const _ = require("lodash");
|
|||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const {current_user, page_params, realm, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, page_params, realm} = require("./lib/zpage_params");
|
||||
|
||||
mock_esm("../src/settings_data", {
|
||||
user_can_access_all_other_users: () => true,
|
||||
|
@ -24,6 +24,10 @@ const user_status = zrequire("user_status");
|
|||
const buddy_data = zrequire("buddy_data");
|
||||
const {Filter} = zrequire("filter");
|
||||
const message_lists = zrequire("message_lists");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
// The buddy_data module is mostly tested indirectly through
|
||||
// activity.test.js, but we should feel free to add direct tests
|
||||
|
|
|
@ -22,6 +22,9 @@ const message_viewport = mock_esm("../src/message_viewport");
|
|||
const buddy_data = zrequire("buddy_data");
|
||||
const {BuddyList} = zrequire("buddy_list");
|
||||
const people = zrequire("people");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
function init_simulated_scrolling() {
|
||||
const elem = {
|
||||
|
|
|
@ -8,7 +8,7 @@ const {mock_banners} = require("./lib/compose_banner");
|
|||
const {mock_esm, set_global, zrequire} = require("./lib/namespace");
|
||||
const {run_test, noop} = require("./lib/test");
|
||||
const $ = require("./lib/zjquery");
|
||||
const {current_user, page_params, realm, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, page_params, realm} = require("./lib/zpage_params");
|
||||
|
||||
const user_groups = zrequire("user_groups");
|
||||
|
||||
|
@ -59,6 +59,10 @@ const drafts = zrequire("drafts");
|
|||
const echo = zrequire("echo");
|
||||
const people = zrequire("people");
|
||||
const stream_data = zrequire("stream_data");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
function reset_jquery() {
|
||||
// Avoid leaks.
|
||||
|
|
|
@ -27,6 +27,9 @@ const channel = mock_esm("../src/channel");
|
|||
const compose_reply = zrequire("compose_reply");
|
||||
const message_lists = zrequire("message_lists");
|
||||
const text_field_edit = mock_esm("text-field-edit");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const alice = {
|
||||
email: "alice@zulip.com",
|
||||
|
|
|
@ -6,7 +6,7 @@ const {mock_banners} = require("./lib/compose_banner");
|
|||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace");
|
||||
const {run_test, noop} = require("./lib/test");
|
||||
const $ = require("./lib/zjquery");
|
||||
const {current_user, realm, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, realm} = require("./lib/zpage_params");
|
||||
|
||||
let autosize_called;
|
||||
|
||||
|
@ -57,6 +57,10 @@ const compose_pm_pill = zrequire("compose_pm_pill");
|
|||
const compose_recipient = zrequire("compose_recipient");
|
||||
const composebox_typeahead = zrequire("composebox_typeahead");
|
||||
const settings_config = zrequire("settings_config");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const ct = composebox_typeahead;
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ const {
|
|||
page_params,
|
||||
realm,
|
||||
realm_user_settings_defaults,
|
||||
user_settings,
|
||||
} = require("./lib/zpage_params");
|
||||
|
||||
const event_fixtures = events.fixtures;
|
||||
|
@ -103,6 +102,10 @@ const user_group_edit = mock_esm("../src/user_group_edit");
|
|||
const overlays = mock_esm("../src/overlays");
|
||||
mock_esm("../src/giphy");
|
||||
const {Filter} = zrequire("filter");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
message_lists.update_recipient_bar_background_color = noop;
|
||||
message_lists.current = {
|
||||
|
|
|
@ -16,6 +16,9 @@ const compose_state = zrequire("compose_state");
|
|||
const compose_recipient = zrequire("compose_recipient");
|
||||
const sub_store = zrequire("sub_store");
|
||||
const stream_data = zrequire("stream_data");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const aaron = {
|
||||
email: "aaron@zulip.com",
|
||||
|
|
|
@ -19,11 +19,14 @@ const people = zrequire("people");
|
|||
const stream_data = zrequire("stream_data");
|
||||
const stream_topic_history = zrequire("stream_topic_history");
|
||||
const unread = zrequire("unread");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
// It's typical to set up a little bit of data at the top of a
|
||||
// test module, but you can also do this within tests. Here we
|
||||
// will set up things at the top.
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const isaac = make_user({
|
||||
email: "isaac@example.com",
|
||||
user_id: 30,
|
||||
|
|
|
@ -46,6 +46,9 @@ message_lists.non_rendered_data = () => [];
|
|||
const message_events = zrequire("message_events");
|
||||
const message_store = zrequire("message_store");
|
||||
const people = zrequire("people");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const isaac = make_user({
|
||||
email: "isaac@example.com",
|
||||
|
|
|
@ -17,6 +17,9 @@ const resolved_topic = zrequire("../shared/src/resolved_topic");
|
|||
const stream_data = zrequire("stream_data");
|
||||
const people = zrequire("people");
|
||||
const {Filter} = zrequire("../src/filter");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const stream_message = "stream";
|
||||
const direct_message = "private";
|
||||
|
|
|
@ -6,7 +6,6 @@ const {mock_esm, set_global, zrequire} = require("./lib/namespace");
|
|||
const {run_test} = require("./lib/test");
|
||||
const blueslip = require("./lib/zblueslip");
|
||||
const $ = require("./lib/zjquery");
|
||||
const {user_settings} = require("./lib/zpage_params");
|
||||
|
||||
let $window_stub;
|
||||
set_global("to_$", () => $window_stub);
|
||||
|
@ -37,6 +36,10 @@ const hashchange = zrequire("hashchange");
|
|||
const message_view = zrequire("../src/message_view");
|
||||
const stream_data = zrequire("stream_data");
|
||||
const {Filter} = zrequire("../src/filter");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const devel_id = 100;
|
||||
const devel = {
|
||||
|
|
|
@ -131,8 +131,6 @@ test.set_verbose(files.length === 1);
|
|||
require("../../src/page_params");
|
||||
namespace.mock_esm("../../src/state_data", zpage_params);
|
||||
require("../../src/state_data");
|
||||
namespace.mock_esm("../../src/user_settings", zpage_params);
|
||||
require("../../src/user_settings");
|
||||
namespace.mock_esm("../../src/realm_user_settings_defaults", zpage_params);
|
||||
require("../../src/realm_user_settings_defaults");
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ exports.current_user = {};
|
|||
exports.page_params = {};
|
||||
exports.realm = {};
|
||||
exports.realm_user_settings_defaults = {};
|
||||
exports.user_settings = {};
|
||||
|
||||
exports.reset = () => {
|
||||
for (const field in exports.current_user) {
|
||||
|
@ -22,11 +21,6 @@ exports.reset = () => {
|
|||
delete exports.realm[field];
|
||||
}
|
||||
}
|
||||
for (const field in exports.user_settings) {
|
||||
if (Object.hasOwn(exports.user_settings, field)) {
|
||||
delete exports.user_settings[field];
|
||||
}
|
||||
}
|
||||
for (const field in exports.realm_user_settings_defaults) {
|
||||
if (Object.hasOwn(exports.realm_user_settings_defaults, field)) {
|
||||
delete exports.realm_user_settings_defaults[field];
|
||||
|
|
|
@ -7,7 +7,7 @@ const markdown_test_cases = require("../../zerver/tests/fixtures/markdown_test_c
|
|||
const markdown_assert = require("./lib/markdown_assert");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const {page_params, user_settings} = require("./lib/zpage_params");
|
||||
const {page_params} = require("./lib/zpage_params");
|
||||
|
||||
const example_realm_linkifiers = [
|
||||
{
|
||||
|
@ -55,6 +55,10 @@ const people = zrequire("people");
|
|||
const pygments_data = zrequire("pygments_data");
|
||||
const stream_data = zrequire("stream_data");
|
||||
const user_groups = zrequire("user_groups");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const emoji_params = {
|
||||
realm_emoji: {
|
||||
|
|
|
@ -28,6 +28,9 @@ const message_helper = zrequire("message_helper");
|
|||
const stream_data = zrequire("stream_data");
|
||||
const stream_topic_history = zrequire("stream_topic_history");
|
||||
const unread = zrequire("unread");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const alice = {
|
||||
email: "alice@example.com",
|
||||
|
|
|
@ -22,6 +22,9 @@ mock_esm("../src/left_sidebar_navigation_area", {
|
|||
|
||||
const message_flags = zrequire("message_flags");
|
||||
const starred_messages_ui = zrequire("starred_messages_ui");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
run_test("starred", ({override}) => {
|
||||
const message = {
|
||||
|
|
|
@ -30,6 +30,9 @@ const pm_conversations = zrequire("pm_conversations");
|
|||
const message_helper = zrequire("message_helper");
|
||||
const message_store = zrequire("message_store");
|
||||
const message_user_ids = zrequire("message_user_ids");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const denmark = {
|
||||
subscribed: false,
|
||||
|
|
|
@ -20,6 +20,9 @@ const recent_view_util = zrequire("recent_view_util");
|
|||
const inbox_util = zrequire("inbox_util");
|
||||
const message_lists = zrequire("message_lists");
|
||||
const user_groups = zrequire("user_groups");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
mock_esm("../src/compose_banner", {
|
||||
clear_errors() {},
|
||||
|
|
|
@ -6,6 +6,9 @@ const {zrequire} = require("./lib/namespace");
|
|||
const {run_test} = require("./lib/test");
|
||||
|
||||
const muted_users = zrequire("muted_users");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
function test(label, f) {
|
||||
run_test(label, ({override}) => {
|
||||
|
|
|
@ -5,7 +5,7 @@ const assert = require("node:assert/strict");
|
|||
const {mock_esm, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const $ = require("./lib/zjquery");
|
||||
const {current_user, page_params, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, page_params} = require("./lib/zpage_params");
|
||||
|
||||
mock_esm("../src/electron_bridge");
|
||||
mock_esm("../src/spoilers", {hide_spoilers_in_notification() {}});
|
||||
|
@ -15,6 +15,10 @@ const stream_data = zrequire("stream_data");
|
|||
|
||||
const desktop_notifications = zrequire("desktop_notifications");
|
||||
const message_notifications = zrequire("message_notifications");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
// Not muted streams
|
||||
const general = {
|
||||
|
|
|
@ -10,7 +10,7 @@ const {$t} = require("./lib/i18n");
|
|||
const {mock_esm, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const blueslip = require("./lib/zblueslip");
|
||||
const {current_user, page_params, realm, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, page_params, realm} = require("./lib/zpage_params");
|
||||
|
||||
const message_user_ids = mock_esm("../src/message_user_ids");
|
||||
const settings_data = mock_esm("../src/settings_data", {
|
||||
|
@ -20,6 +20,10 @@ const settings_data = mock_esm("../src/settings_data", {
|
|||
const muted_users = zrequire("muted_users");
|
||||
const people = zrequire("people");
|
||||
const user_groups = zrequire("user_groups");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const welcome_bot = {
|
||||
email: "welcome-bot@example.com",
|
||||
|
|
|
@ -23,6 +23,9 @@ const people = zrequire("people");
|
|||
const pm_conversations = zrequire("pm_conversations");
|
||||
const pm_list_data = zrequire("pm_list_data");
|
||||
const message_lists = zrequire("message_lists");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const alice = {
|
||||
email: "alice@zulip.com",
|
||||
|
|
|
@ -4,11 +4,14 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const {user_settings} = require("./lib/zpage_params");
|
||||
|
||||
const thumbnail = mock_esm("../src/thumbnail");
|
||||
|
||||
const {postprocess_content} = zrequire("postprocess_content");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
run_test("postprocess_content", () => {
|
||||
assert.equal(
|
||||
|
|
|
@ -4,7 +4,7 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const {realm, user_settings} = require("./lib/zpage_params");
|
||||
const {realm} = require("./lib/zpage_params");
|
||||
|
||||
mock_esm("../src/settings_data", {
|
||||
user_can_access_all_other_users: () => true,
|
||||
|
@ -12,6 +12,10 @@ mock_esm("../src/settings_data", {
|
|||
|
||||
const people = zrequire("people");
|
||||
const presence = zrequire("presence");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const OFFLINE_THRESHOLD_SECS = 200;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ const {make_stub} = require("./lib/stub");
|
|||
const {run_test, noop} = require("./lib/test");
|
||||
const blueslip = require("./lib/zblueslip");
|
||||
const $ = require("./lib/zjquery");
|
||||
const {current_user, page_params, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, page_params} = require("./lib/zpage_params");
|
||||
|
||||
const alice_user_id = 5;
|
||||
|
||||
|
@ -59,6 +59,10 @@ const emoji = zrequire("emoji");
|
|||
const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json");
|
||||
const people = zrequire("people");
|
||||
const reactions = zrequire("reactions");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const emoji_params = {
|
||||
realm_emoji: {
|
||||
|
|
|
@ -7,7 +7,7 @@ const {mock_cjs, mock_esm, zrequire} = require("./lib/namespace");
|
|||
const {run_test, noop} = require("./lib/test");
|
||||
const blueslip = require("./lib/zblueslip");
|
||||
const $ = require("./lib/zjquery");
|
||||
const {realm, user_settings} = require("./lib/zpage_params");
|
||||
const {realm} = require("./lib/zpage_params");
|
||||
|
||||
let clipboard_args;
|
||||
class Clipboard {
|
||||
|
@ -33,6 +33,10 @@ const message_store = mock_esm("../src/message_store");
|
|||
mock_esm("../src/settings_data", {
|
||||
user_can_access_all_other_users: () => false,
|
||||
});
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const iago = {
|
||||
email: "iago@zulip.com",
|
||||
|
|
|
@ -7,6 +7,9 @@ const {run_test} = require("./lib/test");
|
|||
|
||||
const scheduled_messages = zrequire("scheduled_messages");
|
||||
const compose_send_menu_popover = zrequire("compose_send_menu_popover");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const per_day_stamps = {
|
||||
"2023-04-30": {
|
||||
|
|
|
@ -4,9 +4,12 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const {zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const {user_settings} = require("./lib/zpage_params");
|
||||
|
||||
const settings_config = zrequire("settings_config");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
run_test("all_notifications", ({override}) => {
|
||||
override(user_settings, "enable_stream_desktop_notifications", false);
|
||||
|
|
|
@ -4,11 +4,15 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const {current_user, page_params, realm, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, page_params, realm} = require("./lib/zpage_params");
|
||||
|
||||
const settings_data = zrequire("settings_data");
|
||||
const settings_config = zrequire("settings_config");
|
||||
const user_groups = zrequire("user_groups");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
/*
|
||||
Some methods in settings_data are fairly
|
||||
|
|
|
@ -17,6 +17,9 @@ mock_esm("../src/settings_data", {
|
|||
const settings_muted_users = zrequire("settings_muted_users");
|
||||
const muted_users = zrequire("muted_users");
|
||||
const people = zrequire("people");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
run_test("settings", ({override}) => {
|
||||
people.add_active_user({user_id: 5, email: "five@zulip.com", full_name: "Feivel Fiverson"});
|
||||
|
|
|
@ -26,6 +26,9 @@ const settings_bots = zrequire("settings_bots");
|
|||
const settings_account = zrequire("settings_account");
|
||||
const settings_components = zrequire("settings_components");
|
||||
const settings_org = zrequire("settings_org");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
function test(label, f) {
|
||||
run_test(label, (helpers) => {
|
||||
|
|
|
@ -13,6 +13,9 @@ const list_widget = mock_esm("../src/list_widget", {
|
|||
const settings_user_topics = zrequire("settings_user_topics");
|
||||
const stream_data = zrequire("stream_data");
|
||||
const user_topics = zrequire("user_topics");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const frontend = {
|
||||
stream_id: 101,
|
||||
|
|
|
@ -5,7 +5,6 @@ const assert = require("node:assert/strict");
|
|||
const {mock_esm, with_overrides, zrequire} = require("./lib/namespace");
|
||||
const {make_stub} = require("./lib/stub");
|
||||
const {run_test} = require("./lib/test");
|
||||
const {user_settings} = require("./lib/zpage_params");
|
||||
|
||||
const left_sidebar_navigation_area = mock_esm("../src/left_sidebar_navigation_area", {
|
||||
update_starred_count() {},
|
||||
|
@ -13,6 +12,10 @@ const left_sidebar_navigation_area = mock_esm("../src/left_sidebar_navigation_ar
|
|||
const message_store = zrequire("message_store");
|
||||
const starred_messages = zrequire("starred_messages");
|
||||
const starred_messages_ui = zrequire("starred_messages_ui");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
run_test("add starred", () => {
|
||||
starred_messages.starred_ids.clear();
|
||||
|
|
|
@ -5,7 +5,7 @@ const assert = require("node:assert/strict");
|
|||
const {mock_esm, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const blueslip = require("./lib/zblueslip");
|
||||
const {current_user, page_params, realm, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, page_params, realm} = require("./lib/zpage_params");
|
||||
|
||||
// TODO: Remove after we enable support for
|
||||
// web_public_streams in production.
|
||||
|
@ -20,6 +20,10 @@ const stream_data = zrequire("stream_data");
|
|||
const hash_util = zrequire("hash_util");
|
||||
const stream_settings_data = zrequire("stream_settings_data");
|
||||
const user_groups = zrequire("user_groups");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
mock_esm("../src/group_permission_settings", {
|
||||
get_group_permission_setting_config() {
|
||||
|
|
|
@ -5,7 +5,7 @@ const assert = require("node:assert/strict");
|
|||
const {mock_esm, set_global, zrequire} = require("./lib/namespace");
|
||||
const {run_test, noop} = require("./lib/test");
|
||||
const $ = require("./lib/zjquery");
|
||||
const {current_user, page_params, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, page_params} = require("./lib/zpage_params");
|
||||
|
||||
set_global("document", "document-stub");
|
||||
|
||||
|
@ -35,6 +35,10 @@ const {Filter} = zrequire("../src/filter");
|
|||
const stream_data = zrequire("stream_data");
|
||||
const stream_list = zrequire("stream_list");
|
||||
const stream_list_sort = zrequire("stream_list_sort");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const devel = {
|
||||
name: "devel",
|
||||
|
|
|
@ -6,13 +6,16 @@ const _ = require("lodash");
|
|||
|
||||
const {zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const {user_settings} = require("./lib/zpage_params");
|
||||
|
||||
const people = zrequire("people");
|
||||
const stream_data = zrequire("stream_data");
|
||||
const stream_topic_history = zrequire("stream_topic_history");
|
||||
const stream_list_sort = zrequire("stream_list_sort");
|
||||
const settings_config = zrequire("settings_config");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
function contains_sub(subs, sub) {
|
||||
return subs.some((s) => s.name === sub.name);
|
||||
|
|
|
@ -28,6 +28,9 @@ set_global("page_params", {});
|
|||
const stream_data = zrequire("stream_data");
|
||||
const stream_settings_ui = zrequire("stream_settings_ui");
|
||||
const user_groups = zrequire("user_groups");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
run_test("redraw_left_panel", ({mock_template}) => {
|
||||
const admins_group = {
|
||||
|
|
|
@ -9,7 +9,11 @@ const {$t} = require("./lib/i18n");
|
|||
const {zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const $ = require("./lib/zjquery");
|
||||
const {user_settings} = require("./lib/zpage_params");
|
||||
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const timerender = zrequire("timerender");
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const {current_user, realm, user_settings} = require("./lib/zpage_params");
|
||||
const {current_user, realm} = require("./lib/zpage_params");
|
||||
|
||||
const stream_topic_history = mock_esm("../src/stream_topic_history");
|
||||
|
||||
|
@ -23,6 +23,10 @@ const util = zrequire("util");
|
|||
const ct = zrequire("composebox_typeahead");
|
||||
const th = zrequire("typeahead_helper");
|
||||
const user_groups = zrequire("user_groups");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
let next_id = 0;
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@ const stream_data = mock_esm("../src/stream_data");
|
|||
|
||||
const typing = zrequire("typing");
|
||||
const typing_status = zrequire("../shared/src/typing_status");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const TYPING_STARTED_WAIT_PERIOD = 10000;
|
||||
const TYPING_STOPPED_WAIT_PERIOD = 5000;
|
||||
|
|
|
@ -6,7 +6,7 @@ const _ = require("lodash");
|
|||
|
||||
const {set_global, with_overrides, zrequire} = require("./lib/namespace");
|
||||
const {run_test} = require("./lib/test");
|
||||
const {realm, user_settings} = require("./lib/zpage_params");
|
||||
const {realm} = require("./lib/zpage_params");
|
||||
|
||||
realm.realm_push_notifications_enabled = false;
|
||||
|
||||
|
@ -18,6 +18,10 @@ const people = zrequire("people");
|
|||
const stream_data = zrequire("stream_data");
|
||||
const sub_store = zrequire("sub_store");
|
||||
const unread = zrequire("unread");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
const user_settings = {};
|
||||
initialize_user_settings({user_settings});
|
||||
|
||||
const me = {
|
||||
email: "me@example.com",
|
||||
|
|
|
@ -10,6 +10,9 @@ const channel = mock_esm("../src/channel");
|
|||
const user_status = zrequire("user_status");
|
||||
const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json");
|
||||
const emoji = zrequire("emoji");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const emoji_params = {
|
||||
realm_emoji: {
|
||||
|
|
|
@ -10,6 +10,9 @@ const blueslip = require("./lib/zblueslip");
|
|||
|
||||
const user_topics = zrequire("user_topics");
|
||||
const stream_data = zrequire("stream_data");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
const design = {
|
||||
stream_id: 100,
|
||||
|
|
|
@ -9,10 +9,13 @@ const {set_global, zrequire} = require("./lib/namespace");
|
|||
const {run_test} = require("./lib/test");
|
||||
|
||||
const blueslip = zrequire("blueslip");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
||||
|
||||
set_global("document", {});
|
||||
const util = zrequire("util");
|
||||
|
||||
initialize_user_settings({user_settings: {}});
|
||||
|
||||
run_test("CachedValue", () => {
|
||||
let x = 5;
|
||||
|
||||
|
|
Loading…
Reference in New Issue