2020-08-01 03:43:15 +02:00
|
|
|
"use strict";
|
|
|
|
|
2020-11-30 23:46:45 +01:00
|
|
|
const {strict: assert} = require("assert");
|
|
|
|
|
2023-02-22 23:04:10 +01:00
|
|
|
const events = require("./lib/events");
|
|
|
|
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace");
|
|
|
|
const {make_stub} = require("./lib/stub");
|
2023-12-14 23:51:33 +01:00
|
|
|
const {run_test, noop} = require("./lib/test");
|
2023-02-22 23:04:10 +01:00
|
|
|
const blueslip = require("./lib/zblueslip");
|
|
|
|
const $ = require("./lib/zjquery");
|
2024-02-13 02:08:16 +01:00
|
|
|
const {
|
|
|
|
current_user,
|
|
|
|
page_params,
|
2024-02-13 02:08:24 +01:00
|
|
|
realm,
|
2024-02-13 02:08:16 +01:00
|
|
|
realm_user_settings_defaults,
|
|
|
|
user_settings,
|
|
|
|
} = require("./lib/zpage_params");
|
2020-12-01 00:02:16 +01:00
|
|
|
|
2020-06-12 20:26:04 +02:00
|
|
|
const event_fixtures = events.fixtures;
|
|
|
|
const test_message = events.test_message;
|
|
|
|
const test_user = events.test_user;
|
2020-07-25 22:58:18 +02:00
|
|
|
const typing_person1 = events.typing_person1;
|
2020-06-12 20:26:04 +02:00
|
|
|
|
2023-07-02 14:36:30 +02:00
|
|
|
set_global("requestAnimationFrame", (func) => func());
|
2018-08-19 01:34:26 +02:00
|
|
|
|
2023-10-05 10:20:16 +02:00
|
|
|
const activity_ui = mock_esm("../src/activity_ui");
|
2023-02-22 23:04:10 +01:00
|
|
|
const alert_words_ui = mock_esm("../src/alert_words_ui");
|
|
|
|
const attachments_ui = mock_esm("../src/attachments_ui");
|
2023-10-07 00:09:47 +02:00
|
|
|
const audible_notifications = mock_esm("../src/audible_notifications");
|
2023-02-22 23:04:10 +01:00
|
|
|
const bot_data = mock_esm("../src/bot_data");
|
|
|
|
const compose_pm_pill = mock_esm("../src/compose_pm_pill");
|
|
|
|
const dark_theme = mock_esm("../src/dark_theme");
|
|
|
|
const emoji_picker = mock_esm("../src/emoji_picker");
|
2023-06-13 09:47:53 +02:00
|
|
|
const gear_menu = mock_esm("../src/gear_menu");
|
2024-04-02 18:28:21 +02:00
|
|
|
const information_density = mock_esm("../src/information_density");
|
2023-02-22 23:04:10 +01:00
|
|
|
const linkifiers = mock_esm("../src/linkifiers");
|
|
|
|
const message_events = mock_esm("../src/message_events");
|
|
|
|
const message_lists = mock_esm("../src/message_lists");
|
2023-06-24 07:57:58 +02:00
|
|
|
const user_topics_ui = mock_esm("../src/user_topics_ui");
|
2023-02-22 23:04:10 +01:00
|
|
|
const muted_users_ui = mock_esm("../src/muted_users_ui");
|
2023-10-05 23:18:00 +02:00
|
|
|
const narrow_title = mock_esm("../src/narrow_title");
|
2024-03-19 14:22:03 +01:00
|
|
|
const navbar_alerts = mock_esm("../src/navbar_alerts");
|
2023-02-22 23:04:10 +01:00
|
|
|
const pm_list = mock_esm("../src/pm_list");
|
2024-05-28 22:55:41 +02:00
|
|
|
const reactions = mock_esm("../src/reactions", {
|
|
|
|
generate_clean_reactions() {},
|
|
|
|
});
|
2023-02-22 23:04:10 +01:00
|
|
|
const realm_icon = mock_esm("../src/realm_icon");
|
|
|
|
const realm_logo = mock_esm("../src/realm_logo");
|
|
|
|
const realm_playground = mock_esm("../src/realm_playground");
|
|
|
|
const reload = mock_esm("../src/reload");
|
2023-05-01 14:29:57 +02:00
|
|
|
const scheduled_messages = mock_esm("../src/scheduled_messages");
|
2023-09-26 19:33:53 +02:00
|
|
|
const scheduled_messages_feed_ui = mock_esm("../src/scheduled_messages_feed_ui");
|
2023-05-01 14:29:57 +02:00
|
|
|
const scheduled_messages_overlay_ui = mock_esm("../src/scheduled_messages_overlay_ui");
|
2023-09-26 19:33:53 +02:00
|
|
|
const scheduled_messages_ui = mock_esm("../src/scheduled_messages_ui");
|
2023-02-22 23:04:10 +01:00
|
|
|
const scroll_bar = mock_esm("../src/scroll_bar");
|
|
|
|
const settings_account = mock_esm("../src/settings_account");
|
|
|
|
const settings_bots = mock_esm("../src/settings_bots");
|
|
|
|
const settings_emoji = mock_esm("../src/settings_emoji");
|
|
|
|
const settings_exports = mock_esm("../src/settings_exports");
|
|
|
|
const settings_invites = mock_esm("../src/settings_invites");
|
|
|
|
const settings_linkifiers = mock_esm("../src/settings_linkifiers");
|
|
|
|
const settings_playgrounds = mock_esm("../src/settings_playgrounds");
|
|
|
|
const settings_notifications = mock_esm("../src/settings_notifications");
|
|
|
|
const settings_org = mock_esm("../src/settings_org");
|
|
|
|
const settings_profile_fields = mock_esm("../src/settings_profile_fields");
|
2024-01-09 20:36:02 +01:00
|
|
|
const settings_preferences = mock_esm("../src/settings_preferences");
|
2021-10-02 13:34:52 +02:00
|
|
|
const settings_realm_user_settings_defaults = mock_esm(
|
2023-02-22 23:04:10 +01:00
|
|
|
"../src/settings_realm_user_settings_defaults",
|
2021-10-02 13:34:52 +02:00
|
|
|
);
|
2023-02-22 23:04:10 +01:00
|
|
|
const settings_realm_domains = mock_esm("../src/settings_realm_domains");
|
|
|
|
const settings_streams = mock_esm("../src/settings_streams");
|
|
|
|
const settings_users = mock_esm("../src/settings_users");
|
2023-10-02 23:21:22 +02:00
|
|
|
const sidebar_ui = mock_esm("../src/sidebar_ui");
|
2023-02-22 23:04:10 +01:00
|
|
|
const stream_data = mock_esm("../src/stream_data");
|
|
|
|
const stream_list = mock_esm("../src/stream_list");
|
|
|
|
const stream_settings_ui = mock_esm("../src/stream_settings_ui");
|
2023-04-24 07:37:18 +02:00
|
|
|
const stream_list_sort = mock_esm("../src/stream_list_sort");
|
2023-02-22 23:04:10 +01:00
|
|
|
const stream_topic_history = mock_esm("../src/stream_topic_history");
|
2023-06-01 01:19:38 +02:00
|
|
|
const stream_ui_updates = mock_esm("../src/stream_ui_updates", {
|
|
|
|
update_announce_stream_option() {},
|
|
|
|
});
|
2023-02-22 23:04:10 +01:00
|
|
|
const submessage = mock_esm("../src/submessage");
|
2023-06-15 17:07:10 +02:00
|
|
|
mock_esm("../src/left_sidebar_navigation_area", {
|
2022-07-10 01:06:33 +02:00
|
|
|
update_starred_count() {},
|
2023-05-02 21:08:15 +02:00
|
|
|
update_scheduled_messages_row() {},
|
2023-10-23 21:12:18 +02:00
|
|
|
handle_home_view_changed() {},
|
2022-07-10 01:06:33 +02:00
|
|
|
});
|
2023-02-22 23:04:10 +01:00
|
|
|
const typing_events = mock_esm("../src/typing_events");
|
|
|
|
const unread_ops = mock_esm("../src/unread_ops");
|
2023-03-08 02:27:45 +01:00
|
|
|
const unread_ui = mock_esm("../src/unread_ui");
|
2023-02-22 23:04:10 +01:00
|
|
|
const user_events = mock_esm("../src/user_events");
|
|
|
|
const user_groups = mock_esm("../src/user_groups");
|
|
|
|
const user_group_edit = mock_esm("../src/user_group_edit");
|
|
|
|
const overlays = mock_esm("../src/overlays");
|
|
|
|
mock_esm("../src/giphy");
|
2024-04-21 05:31:35 +02:00
|
|
|
const {Filter} = zrequire("filter");
|
2021-03-10 14:44:11 +01:00
|
|
|
|
|
|
|
const electron_bridge = set_global("electron_bridge", {});
|
|
|
|
|
2023-04-08 01:39:52 +02:00
|
|
|
message_lists.update_recipient_bar_background_color = noop;
|
2022-08-18 00:03:29 +02:00
|
|
|
message_lists.current = {
|
2023-04-25 05:36:10 +02:00
|
|
|
get_row: noop,
|
2022-08-18 00:03:29 +02:00
|
|
|
rerender_view: noop,
|
|
|
|
data: {
|
|
|
|
get_messages_sent_by_user: () => [],
|
2024-04-21 05:31:35 +02:00
|
|
|
filter: new Filter([]),
|
2022-08-18 00:03:29 +02:00
|
|
|
},
|
|
|
|
};
|
2024-04-21 05:31:35 +02:00
|
|
|
const cached_message_list = {
|
2023-04-25 05:36:10 +02:00
|
|
|
get_row: noop,
|
2022-08-18 00:03:29 +02:00
|
|
|
rerender_view: noop,
|
|
|
|
data: {
|
|
|
|
get_messages_sent_by_user: () => [],
|
|
|
|
},
|
|
|
|
};
|
2024-04-21 05:31:35 +02:00
|
|
|
message_lists.all_rendered_message_lists = () => [cached_message_list, message_lists.current];
|
2021-02-28 00:42:57 +01:00
|
|
|
|
2016-08-05 21:44:51 +02:00
|
|
|
// page_params is highly coupled to dispatching now
|
2021-03-25 22:35:45 +01:00
|
|
|
page_params.test_suite = false;
|
2024-02-13 02:08:16 +01:00
|
|
|
current_user.is_admin = true;
|
2024-02-13 02:08:24 +01:00
|
|
|
realm.realm_description = "already set description";
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2020-02-26 23:53:46 +01:00
|
|
|
// For data-oriented modules, just use them, don't stub them.
|
2021-02-10 04:53:22 +01:00
|
|
|
const alert_words = zrequire("alert_words");
|
2022-03-25 14:47:51 +01:00
|
|
|
const emoji = zrequire("emoji");
|
2021-02-10 04:53:22 +01:00
|
|
|
const message_store = zrequire("message_store");
|
2020-08-20 21:24:06 +02:00
|
|
|
const people = zrequire("people");
|
2021-02-10 04:53:22 +01:00
|
|
|
const user_status = zrequire("user_status");
|
2024-06-03 09:11:07 +02:00
|
|
|
const onboarding_steps = zrequire("onboarding_steps");
|
2020-07-15 01:29:15 +02:00
|
|
|
|
2021-02-10 04:53:22 +01:00
|
|
|
const server_events_dispatch = zrequire("server_events_dispatch");
|
2016-08-05 21:44:51 +02:00
|
|
|
|
|
|
|
function dispatch(ev) {
|
2019-01-25 20:03:10 +01:00
|
|
|
server_events_dispatch.dispatch_normal_event(ev);
|
2016-08-05 21:44:51 +02:00
|
|
|
}
|
|
|
|
|
2024-03-19 14:22:03 +01:00
|
|
|
const me = {
|
|
|
|
email: "me@example.com",
|
|
|
|
user_id: 20,
|
|
|
|
full_name: "Me Myself",
|
|
|
|
timezone: "America/Los_Angeles",
|
|
|
|
};
|
|
|
|
|
2019-01-25 20:03:10 +01:00
|
|
|
people.init();
|
2024-03-19 14:22:03 +01:00
|
|
|
people.add_active_user(me);
|
2020-05-26 22:34:15 +02:00
|
|
|
people.add_active_user(test_user);
|
2024-03-19 14:22:03 +01:00
|
|
|
people.initialize_current_user(me.user_id);
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2024-05-28 08:11:17 +02:00
|
|
|
message_store.update_message_cache(test_message);
|
2019-01-26 18:49:10 +01:00
|
|
|
|
2020-07-25 23:59:49 +02:00
|
|
|
const realm_emoji = {};
|
2023-02-22 23:03:47 +01:00
|
|
|
const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json");
|
2020-07-25 23:59:49 +02:00
|
|
|
|
|
|
|
emoji.initialize({realm_emoji, emoji_codes});
|
|
|
|
|
2016-08-05 21:44:51 +02:00
|
|
|
function assert_same(actual, expected) {
|
|
|
|
// This helper prevents us from getting false positives
|
|
|
|
// where actual and expected are both undefined.
|
2021-06-08 04:55:41 +02:00
|
|
|
assert.notEqual(expected, undefined);
|
2016-08-05 21:44:51 +02:00
|
|
|
assert.deepEqual(actual, expected);
|
|
|
|
}
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("alert_words", ({override}) => {
|
2021-03-10 14:30:51 +01:00
|
|
|
alert_words.initialize({alert_words: []});
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(!alert_words.has_alert_word("fire"));
|
|
|
|
assert.ok(!alert_words.has_alert_word("lunch"));
|
2020-02-26 23:53:46 +01:00
|
|
|
|
2022-02-26 01:58:57 +01:00
|
|
|
override(alert_words_ui, "rerender_alert_words_ui", noop);
|
2019-11-02 00:06:25 +01:00
|
|
|
const event = event_fixtures.alert_words;
|
2016-08-05 21:44:51 +02:00
|
|
|
dispatch(event);
|
|
|
|
|
2024-03-19 08:05:51 +01:00
|
|
|
assert.deepEqual(alert_words.get_word_list(), [{word: "lunch"}, {word: "fire"}]);
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(alert_words.has_alert_word("fire"));
|
|
|
|
assert.ok(alert_words.has_alert_word("lunch"));
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("attachments", ({override}) => {
|
2020-08-05 19:04:42 +02:00
|
|
|
const event = event_fixtures.attachment__add;
|
2021-02-13 03:46:14 +01:00
|
|
|
const stub = make_stub();
|
|
|
|
// attachments_ui is hard to test deeply
|
|
|
|
override(attachments_ui, "update_attachments", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
assert_same(stub.get_args("event").event, event);
|
2018-08-19 00:02:08 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("user groups", ({override}) => {
|
2019-11-02 00:06:25 +01:00
|
|
|
let event = event_fixtures.user_group__add;
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2023-02-02 17:49:02 +01:00
|
|
|
const user_group_settings_ui_stub = make_stub();
|
|
|
|
|
2021-02-11 01:23:23 +01:00
|
|
|
override(user_groups, "add", stub.f);
|
2023-02-02 17:49:02 +01:00
|
|
|
override(overlays, "groups_open", () => true);
|
2023-10-07 09:30:27 +02:00
|
|
|
override(user_group_edit, "add_group_to_table", user_group_settings_ui_stub.f);
|
2023-02-02 17:49:02 +01:00
|
|
|
|
2018-04-15 21:26:58 +02:00
|
|
|
dispatch(event);
|
2023-02-02 17:49:02 +01:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2023-02-02 17:49:02 +01:00
|
|
|
assert.equal(user_group_settings_ui_stub.num_calls, 1);
|
|
|
|
|
|
|
|
let args = stub.get_args("group");
|
|
|
|
assert_same(args.group, event.group);
|
|
|
|
args = user_group_settings_ui_stub.get_args("group");
|
2018-04-15 21:26:58 +02:00
|
|
|
assert_same(args.group, event.group);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2018-04-15 21:26:58 +02:00
|
|
|
|
2021-03-26 18:25:36 +01:00
|
|
|
event = event_fixtures.user_group__remove;
|
|
|
|
{
|
|
|
|
const stub = make_stub();
|
|
|
|
override(user_groups, "get_user_group_from_id", stub.f);
|
|
|
|
override(user_groups, "remove", noop);
|
2023-02-03 10:37:42 +01:00
|
|
|
const user_group_edit_stub = make_stub();
|
|
|
|
override(user_group_edit, "handle_deleted_group", user_group_edit_stub.f);
|
|
|
|
|
2021-03-26 18:25:36 +01:00
|
|
|
dispatch(event);
|
2023-02-03 10:37:42 +01:00
|
|
|
|
2021-03-26 18:25:36 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2023-02-03 10:37:42 +01:00
|
|
|
assert.equal(user_group_edit_stub.num_calls, 1);
|
|
|
|
|
|
|
|
let args = stub.get_args("group_id");
|
|
|
|
assert_same(args.group_id, event.group_id);
|
|
|
|
args = user_group_edit_stub.get_args("group_id");
|
2021-03-26 18:25:36 +01:00
|
|
|
assert_same(args.group_id, event.group_id);
|
|
|
|
}
|
|
|
|
|
2018-04-15 21:26:58 +02:00
|
|
|
event = event_fixtures.user_group__add_members;
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-02-11 01:23:23 +01:00
|
|
|
override(user_groups, "add_members", stub.f);
|
2023-02-06 16:51:04 +01:00
|
|
|
const user_group_edit_stub = make_stub();
|
|
|
|
override(user_group_edit, "handle_member_edit_event", user_group_edit_stub.f);
|
2018-04-15 21:26:58 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2023-02-06 16:51:04 +01:00
|
|
|
assert.equal(user_group_edit_stub.num_calls, 1);
|
|
|
|
let args = stub.get_args("group_id", "user_ids");
|
2018-04-15 21:26:58 +02:00
|
|
|
assert_same(args.group_id, event.group_id);
|
|
|
|
assert_same(args.user_ids, event.user_ids);
|
2023-02-06 16:51:04 +01:00
|
|
|
args = user_group_edit_stub.get_args("group_id");
|
|
|
|
assert_same(args.group_id, event.group_id);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2018-04-15 21:26:58 +02:00
|
|
|
|
2022-05-02 16:41:51 +02:00
|
|
|
event = event_fixtures.user_group__add_subgroups;
|
|
|
|
{
|
|
|
|
const stub = make_stub();
|
|
|
|
override(user_groups, "add_subgroups", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
2022-05-16 17:02:44 +02:00
|
|
|
const args = stub.get_args("group_id", "direct_subgroup_ids");
|
2022-05-02 16:41:51 +02:00
|
|
|
assert_same(args.group_id, event.group_id);
|
2022-05-16 17:02:44 +02:00
|
|
|
assert_same(args.direct_subgroup_ids, event.direct_subgroup_ids);
|
2022-05-02 16:41:51 +02:00
|
|
|
}
|
|
|
|
|
2018-04-15 21:26:58 +02:00
|
|
|
event = event_fixtures.user_group__remove_members;
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-02-11 01:23:23 +01:00
|
|
|
override(user_groups, "remove_members", stub.f);
|
2023-02-06 16:51:04 +01:00
|
|
|
const user_group_edit_stub = make_stub();
|
|
|
|
override(user_group_edit, "handle_member_edit_event", user_group_edit_stub.f);
|
2018-04-15 21:26:58 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2023-02-06 16:51:04 +01:00
|
|
|
assert.equal(user_group_edit_stub.num_calls, 1);
|
|
|
|
let args = stub.get_args("group_id", "user_ids");
|
2018-04-15 21:26:58 +02:00
|
|
|
assert_same(args.group_id, event.group_id);
|
|
|
|
assert_same(args.user_ids, event.user_ids);
|
2023-02-06 16:51:04 +01:00
|
|
|
args = user_group_edit_stub.get_args("group_id");
|
|
|
|
assert_same(args.group_id, event.group_id);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2018-04-15 21:26:58 +02:00
|
|
|
|
2022-05-02 16:41:51 +02:00
|
|
|
event = event_fixtures.user_group__remove_subgroups;
|
|
|
|
{
|
|
|
|
const stub = make_stub();
|
|
|
|
override(user_groups, "remove_subgroups", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
2022-05-16 17:02:44 +02:00
|
|
|
const args = stub.get_args("group_id", "direct_subgroup_ids");
|
2022-05-02 16:41:51 +02:00
|
|
|
assert_same(args.group_id, event.group_id);
|
2022-05-16 17:02:44 +02:00
|
|
|
assert_same(args.direct_subgroup_ids, event.direct_subgroup_ids);
|
2022-05-02 16:41:51 +02:00
|
|
|
}
|
|
|
|
|
2018-04-15 21:26:58 +02:00
|
|
|
event = event_fixtures.user_group__update;
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2023-02-03 10:45:58 +01:00
|
|
|
const user_group_settings_ui_stub = make_stub();
|
|
|
|
|
2021-02-11 01:23:23 +01:00
|
|
|
override(user_groups, "update", stub.f);
|
2023-10-07 09:30:27 +02:00
|
|
|
override(user_group_edit, "update_group", user_group_settings_ui_stub.f);
|
2023-02-03 10:45:58 +01:00
|
|
|
|
2018-04-15 21:26:58 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2023-02-03 10:45:58 +01:00
|
|
|
assert.equal(user_group_settings_ui_stub.num_calls, 1);
|
|
|
|
|
|
|
|
let args = stub.get_args("event");
|
2018-04-15 21:26:58 +02:00
|
|
|
assert_same(args.event.group_id, event.group_id);
|
|
|
|
assert_same(args.event.data.name, event.data.name);
|
|
|
|
assert_same(args.event.data.description, event.data.description);
|
2023-02-03 10:45:58 +01:00
|
|
|
|
|
|
|
args = user_group_settings_ui_stub.get_args("group_id");
|
|
|
|
assert_same(args.group_id, event.group_id);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2018-04-15 21:26:58 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("custom profile fields", ({override}) => {
|
2021-03-26 09:51:43 +01:00
|
|
|
const event = event_fixtures.custom_profile_fields;
|
2021-02-11 01:23:23 +01:00
|
|
|
override(settings_profile_fields, "populate_profile_fields", noop);
|
|
|
|
override(settings_account, "add_custom_profile_fields_to_settings", noop);
|
2024-03-19 14:22:03 +01:00
|
|
|
override(navbar_alerts, "maybe_show_empty_required_profile_fields_alert", noop);
|
2017-12-14 05:51:45 +01:00
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.custom_profile_fields, event.fields);
|
2017-12-14 05:51:45 +01:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("default_streams", ({override}) => {
|
2019-11-02 00:06:25 +01:00
|
|
|
const event = event_fixtures.default_streams;
|
2021-02-11 01:23:23 +01:00
|
|
|
override(settings_streams, "update_default_streams_table", noop);
|
2023-07-22 12:24:55 +02:00
|
|
|
override(stream_settings_ui, "update_is_default_stream", noop);
|
2021-02-13 03:46:14 +01:00
|
|
|
const stub = make_stub();
|
|
|
|
override(stream_data, "set_realm_default_streams", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("realm_default_streams");
|
|
|
|
assert_same(args.realm_default_streams, event.default_streams);
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2024-05-10 15:37:43 +02:00
|
|
|
run_test("onboarding_steps", () => {
|
2024-06-03 09:11:07 +02:00
|
|
|
onboarding_steps.initialize({onboarding_steps: []});
|
2023-12-02 11:30:35 +01:00
|
|
|
const event = event_fixtures.onboarding_steps;
|
2024-06-03 09:11:07 +02:00
|
|
|
const one_time_notices = new Set();
|
|
|
|
for (const onboarding_step of event.onboarding_steps) {
|
|
|
|
one_time_notices.add(onboarding_step.name);
|
|
|
|
}
|
2017-05-31 06:34:53 +02:00
|
|
|
dispatch(event);
|
2024-06-03 09:11:07 +02:00
|
|
|
assert_same(onboarding_steps.ONE_TIME_NOTICES_TO_DISPLAY, one_time_notices);
|
2017-05-31 06:34:53 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("invites_changed", ({override}) => {
|
2021-02-22 17:01:29 +01:00
|
|
|
$.create("#admin-invites-list", {children: ["stub"]});
|
2019-11-02 00:06:25 +01:00
|
|
|
const event = event_fixtures.invites_changed;
|
2021-02-13 03:46:14 +01:00
|
|
|
const stub = make_stub();
|
|
|
|
override(settings_invites, "set_up", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
2018-08-19 00:02:08 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("muted_topics", ({override}) => {
|
2022-08-26 22:59:07 +02:00
|
|
|
const event = event_fixtures.user_topic;
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
const stub = make_stub();
|
2023-06-24 07:57:58 +02:00
|
|
|
override(user_topics_ui, "handle_topic_updates", stub.f);
|
2021-02-13 03:46:14 +01:00
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
2022-08-26 22:59:07 +02:00
|
|
|
const args = stub.get_args("user_topic");
|
|
|
|
assert_same(args.user_topic, event);
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("muted_users", ({override}) => {
|
2021-03-27 12:42:16 +01:00
|
|
|
const event = event_fixtures.muted_users;
|
|
|
|
|
|
|
|
const stub = make_stub();
|
2021-07-08 20:28:14 +02:00
|
|
|
override(muted_users_ui, "handle_user_updates", stub.f);
|
2021-03-27 12:42:16 +01:00
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("muted_users");
|
|
|
|
assert_same(args.muted_users, event.muted_users);
|
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("presence", ({override}) => {
|
2019-11-02 00:06:25 +01:00
|
|
|
const event = event_fixtures.presence;
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
const stub = make_stub();
|
2023-10-05 10:20:16 +02:00
|
|
|
override(activity_ui, "update_presence_info", stub.f);
|
2021-02-13 03:46:14 +01:00
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("user_id", "presence", "server_time");
|
|
|
|
assert_same(args.user_id, event.user_id);
|
|
|
|
assert_same(args.presence, event.presence);
|
|
|
|
assert_same(args.server_time, event.server_timestamp);
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("reaction", ({override}) => {
|
2019-11-02 00:06:25 +01:00
|
|
|
let event = event_fixtures.reaction__add;
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-02-11 01:23:23 +01:00
|
|
|
override(reactions, "add_reaction", stub.f);
|
2017-05-31 06:37:52 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2020-07-15 01:29:15 +02:00
|
|
|
const args = stub.get_args("event");
|
2017-05-31 06:37:52 +02:00
|
|
|
assert_same(args.event.emoji_name, event.emoji_name);
|
|
|
|
assert_same(args.event.message_id, event.message_id);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2017-05-31 06:37:52 +02:00
|
|
|
|
|
|
|
event = event_fixtures.reaction__remove;
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-02-11 01:23:23 +01:00
|
|
|
override(reactions, "remove_reaction", stub.f);
|
2017-05-31 06:37:52 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2020-07-15 01:29:15 +02:00
|
|
|
const args = stub.get_args("event");
|
2017-05-31 06:37:52 +02:00
|
|
|
assert_same(args.event.emoji_name, event.emoji_name);
|
|
|
|
assert_same(args.event.message_id, event.message_id);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2017-05-31 06:37:52 +02:00
|
|
|
});
|
|
|
|
|
2023-05-01 14:29:57 +02:00
|
|
|
run_test("scheduled_messages", ({override}) => {
|
|
|
|
override(scheduled_messages_overlay_ui, "rerender", noop);
|
|
|
|
override(scheduled_messages_overlay_ui, "remove_scheduled_message_id", noop);
|
2023-09-26 19:33:53 +02:00
|
|
|
override(scheduled_messages_feed_ui, "update_schedule_message_indicator", noop);
|
|
|
|
override(scheduled_messages_ui, "hide_scheduled_message_success_compose_banner", noop);
|
|
|
|
|
2023-05-01 14:29:57 +02:00
|
|
|
let event = event_fixtures.scheduled_messages__add;
|
|
|
|
{
|
|
|
|
const stub = make_stub();
|
|
|
|
override(scheduled_messages, "add_scheduled_messages", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("scheduled_messages");
|
|
|
|
assert_same(args.scheduled_messages, event.scheduled_messages);
|
|
|
|
}
|
|
|
|
event = event_fixtures.scheduled_messages__update;
|
|
|
|
{
|
|
|
|
const stub = make_stub();
|
|
|
|
override(scheduled_messages, "update_scheduled_message", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("scheduled_message");
|
|
|
|
assert_same(args.scheduled_message, event.scheduled_message);
|
|
|
|
}
|
|
|
|
event = event_fixtures.scheduled_messages__remove;
|
|
|
|
{
|
|
|
|
const stub = make_stub();
|
|
|
|
override(scheduled_messages, "remove_scheduled_message", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("scheduled_message_id");
|
|
|
|
assert_same(args.scheduled_message_id, event.scheduled_message_id);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("realm settings", ({override}) => {
|
2024-02-13 02:08:16 +01:00
|
|
|
current_user.is_admin = true;
|
2024-02-13 02:08:24 +01:00
|
|
|
realm.realm_date_created = new Date("2023-01-01Z");
|
2021-04-03 19:07:13 +02:00
|
|
|
|
2021-02-11 01:23:23 +01:00
|
|
|
override(settings_org, "sync_realm_settings", noop);
|
|
|
|
override(settings_bots, "update_bot_permissions_ui", noop);
|
2023-06-13 09:47:53 +02:00
|
|
|
override(settings_invites, "update_invite_user_panel", noop);
|
2023-10-02 23:21:22 +02:00
|
|
|
override(sidebar_ui, "update_invite_user_option", noop);
|
2023-10-13 12:51:35 +02:00
|
|
|
override(gear_menu, "rerender", noop);
|
2023-10-05 23:18:00 +02:00
|
|
|
override(narrow_title, "redraw_title", noop);
|
2024-03-19 14:22:03 +01:00
|
|
|
override(navbar_alerts, "check_profile_incomplete", noop);
|
|
|
|
override(navbar_alerts, "show_profile_incomplete", noop);
|
2020-07-26 12:20:40 +02:00
|
|
|
|
2021-03-10 14:44:11 +01:00
|
|
|
function test_electron_dispatch(event, fake_send_event) {
|
2022-07-09 23:25:05 +02:00
|
|
|
with_overrides(({override}) => {
|
|
|
|
override(electron_bridge, "send_event", fake_send_event);
|
2021-03-10 14:44:11 +01:00
|
|
|
dispatch(event);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-08-05 21:44:51 +02:00
|
|
|
// realm
|
|
|
|
function test_realm_boolean(event, parameter_name) {
|
2024-02-13 02:08:24 +01:00
|
|
|
realm[parameter_name] = true;
|
2020-07-16 22:40:18 +02:00
|
|
|
event = {...event};
|
2016-08-05 21:44:51 +02:00
|
|
|
event.value = false;
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert.equal(realm[parameter_name], false);
|
2020-07-16 22:40:18 +02:00
|
|
|
event = {...event};
|
2016-08-05 21:44:51 +02:00
|
|
|
event.value = true;
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert.equal(realm[parameter_name], true);
|
2016-08-05 21:44:51 +02:00
|
|
|
}
|
|
|
|
|
2020-04-01 08:54:56 +02:00
|
|
|
function test_realm_integer(event, parameter_name) {
|
2024-02-13 02:08:24 +01:00
|
|
|
realm[parameter_name] = 1;
|
2020-04-01 08:54:56 +02:00
|
|
|
event = {...event};
|
|
|
|
event.value = 2;
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert.equal(realm[parameter_name], 2);
|
2020-04-01 08:54:56 +02:00
|
|
|
|
|
|
|
event = {...event};
|
|
|
|
event.value = 3;
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert.equal(realm[parameter_name], 3);
|
2020-04-01 08:54:56 +02:00
|
|
|
|
|
|
|
event = {...event};
|
|
|
|
event.value = 1;
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert.equal(realm[parameter_name], 1);
|
2020-04-01 08:54:56 +02:00
|
|
|
}
|
|
|
|
|
2021-11-24 15:29:25 +01:00
|
|
|
let update_called = false;
|
2021-03-27 05:48:37 +01:00
|
|
|
let event = event_fixtures.realm__update__create_private_stream_policy;
|
2021-11-24 15:29:25 +01:00
|
|
|
stream_settings_ui.update_stream_privacy_choices = (property) => {
|
|
|
|
assert_same(property, "create_private_stream_policy");
|
|
|
|
update_called = true;
|
|
|
|
};
|
2021-03-27 05:48:37 +01:00
|
|
|
test_realm_integer(event, "realm_create_private_stream_policy");
|
|
|
|
|
2021-11-24 15:29:25 +01:00
|
|
|
update_called = false;
|
2021-03-27 05:48:37 +01:00
|
|
|
event = event_fixtures.realm__update__create_public_stream_policy;
|
2021-11-24 15:29:25 +01:00
|
|
|
stream_settings_ui.update_stream_privacy_choices = (property) => {
|
|
|
|
assert_same(property, "create_public_stream_policy");
|
|
|
|
update_called = true;
|
|
|
|
};
|
2021-03-27 05:48:37 +01:00
|
|
|
test_realm_integer(event, "realm_create_public_stream_policy");
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2021-11-24 15:29:25 +01:00
|
|
|
update_called = false;
|
|
|
|
event = event_fixtures.realm__update__create_web_public_stream_policy;
|
|
|
|
stream_settings_ui.update_stream_privacy_choices = (property) => {
|
|
|
|
assert_same(property, "create_web_public_stream_policy");
|
|
|
|
update_called = true;
|
|
|
|
};
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_create_web_public_stream_policy, 2);
|
2021-11-24 15:29:25 +01:00
|
|
|
assert_same(update_called, true);
|
|
|
|
|
2019-04-08 19:23:00 +02:00
|
|
|
event = event_fixtures.realm__update__invite_to_stream_policy;
|
2020-07-15 01:29:15 +02:00
|
|
|
test_realm_integer(event, "realm_invite_to_stream_policy");
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2020-04-03 02:31:43 +02:00
|
|
|
event = event_fixtures.realm__update__bot_creation_policy;
|
2020-07-15 01:29:15 +02:00
|
|
|
test_realm_integer(event, "realm_bot_creation_policy");
|
2020-04-03 02:31:43 +02:00
|
|
|
|
2016-08-05 21:44:51 +02:00
|
|
|
event = event_fixtures.realm__update__invite_required;
|
2020-07-15 01:29:15 +02:00
|
|
|
test_realm_boolean(event, "realm_invite_required");
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2021-04-04 15:47:33 +02:00
|
|
|
event = event_fixtures.realm__update__invite_to_realm_policy;
|
|
|
|
test_realm_integer(event, "realm_invite_to_realm_policy");
|
|
|
|
|
2022-04-22 18:45:30 +02:00
|
|
|
event = event_fixtures.realm__update__want_advertise_in_communities_directory;
|
|
|
|
test_realm_boolean(event, "realm_want_advertise_in_communities_directory");
|
|
|
|
|
2016-08-05 21:44:51 +02:00
|
|
|
event = event_fixtures.realm__update__name;
|
|
|
|
|
2021-03-10 14:44:11 +01:00
|
|
|
test_electron_dispatch(event, (key, val) => {
|
|
|
|
assert_same(key, "realm_name");
|
|
|
|
assert_same(val, "new_realm_name");
|
2019-07-25 09:13:22 +02:00
|
|
|
});
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_name, "new_realm_name");
|
2018-08-19 01:34:26 +02:00
|
|
|
|
2022-04-12 17:41:07 +02:00
|
|
|
event = event_fixtures.realm__update__org_type;
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_org_type, 50);
|
2022-04-12 17:41:07 +02:00
|
|
|
|
2018-07-27 23:26:29 +02:00
|
|
|
event = event_fixtures.realm__update__emails_restricted_to_domains;
|
2020-07-15 01:29:15 +02:00
|
|
|
test_realm_boolean(event, "realm_emails_restricted_to_domains");
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2018-03-05 19:19:19 +01:00
|
|
|
event = event_fixtures.realm__update__disallow_disposable_email_addresses;
|
2020-07-15 01:29:15 +02:00
|
|
|
test_realm_boolean(event, "realm_disallow_disposable_email_addresses");
|
2018-03-05 19:19:19 +01:00
|
|
|
|
2024-02-07 12:13:02 +01:00
|
|
|
event = event_fixtures.realm__update__new_stream_announcements_stream_id;
|
2018-08-19 01:34:26 +02:00
|
|
|
dispatch(event);
|
2024-02-07 12:13:02 +01:00
|
|
|
assert_same(realm.realm_new_stream_announcements_stream_id, 42);
|
|
|
|
realm.realm_new_stream_announcements_stream_id = -1; // make sure to reset for future tests
|
2018-08-19 01:34:26 +02:00
|
|
|
|
2024-02-07 17:11:43 +01:00
|
|
|
event = event_fixtures.realm__update__signup_announcements_stream_id;
|
2018-08-19 01:34:26 +02:00
|
|
|
dispatch(event);
|
2024-02-07 17:11:43 +01:00
|
|
|
assert_same(realm.realm_signup_announcements_stream_id, 41);
|
|
|
|
realm.realm_signup_announcements_stream_id = -1; // make sure to reset for future tests
|
2018-08-19 01:34:26 +02:00
|
|
|
|
2024-01-26 14:45:37 +01:00
|
|
|
event = event_fixtures.realm__update__zulip_update_announcements_stream_id;
|
|
|
|
dispatch(event);
|
|
|
|
assert_same(realm.realm_zulip_update_announcements_stream_id, 42);
|
|
|
|
realm.realm_zulip_update_announcements_stream_id = -1; // make sure to reset for future tests
|
|
|
|
|
2020-07-29 13:19:47 +02:00
|
|
|
event = event_fixtures.realm__update__default_code_block_language;
|
2020-04-10 09:38:55 +02:00
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_default_code_block_language, "javascript");
|
2020-04-10 09:38:55 +02:00
|
|
|
|
2021-11-24 19:23:52 +01:00
|
|
|
update_called = false;
|
|
|
|
stream_settings_ui.update_stream_privacy_choices = (property) => {
|
|
|
|
assert_same(property, "create_web_public_stream_policy");
|
|
|
|
update_called = true;
|
|
|
|
};
|
|
|
|
event = event_fixtures.realm__update__enable_spectator_access;
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_enable_spectator_access, true);
|
2021-11-24 19:23:52 +01:00
|
|
|
assert_same(update_called, true);
|
|
|
|
|
2016-08-05 21:44:51 +02:00
|
|
|
event = event_fixtures.realm__update_dict__default;
|
2024-02-13 02:08:24 +01:00
|
|
|
realm.realm_create_multiuse_invite_group = 1;
|
|
|
|
realm.realm_allow_message_editing = false;
|
|
|
|
realm.realm_message_content_edit_limit_seconds = 0;
|
|
|
|
realm.realm_edit_topic_policy = 3;
|
2024-02-05 23:52:25 +01:00
|
|
|
realm.realm_authentication_methods = {Google: {enabled: false, available: true}};
|
2021-02-11 01:23:23 +01:00
|
|
|
override(settings_org, "populate_auth_methods", noop);
|
2016-08-05 21:44:51 +02:00
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_create_multiuse_invite_group, 3);
|
|
|
|
assert_same(realm.realm_allow_message_editing, true);
|
|
|
|
assert_same(realm.realm_message_content_edit_limit_seconds, 5);
|
|
|
|
assert_same(realm.realm_edit_topic_policy, 4);
|
2024-02-05 23:52:25 +01:00
|
|
|
assert_same(realm.realm_authentication_methods, {
|
|
|
|
Google: {enabled: true, available: true},
|
|
|
|
});
|
2018-08-19 01:34:26 +02:00
|
|
|
|
|
|
|
event = event_fixtures.realm__update_dict__icon;
|
2021-02-11 01:23:23 +01:00
|
|
|
override(realm_icon, "rerender", noop);
|
2018-08-19 01:34:26 +02:00
|
|
|
|
2021-03-10 14:44:11 +01:00
|
|
|
test_electron_dispatch(event, (key, val) => {
|
|
|
|
assert_same(key, "realm_icon_url");
|
|
|
|
assert_same(val, "icon.png");
|
2019-07-25 09:13:22 +02:00
|
|
|
});
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_icon_url, "icon.png");
|
|
|
|
assert_same(realm.realm_icon_source, "U");
|
2018-08-19 01:34:26 +02:00
|
|
|
|
2021-07-19 13:49:40 +02:00
|
|
|
override(realm_logo, "render", noop);
|
2021-02-11 16:36:12 +01:00
|
|
|
|
|
|
|
event = event_fixtures.realm__update_dict__logo;
|
2019-01-25 20:35:55 +01:00
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_logo_url, "logo.png");
|
|
|
|
assert_same(realm.realm_logo_source, "U");
|
2019-01-25 20:35:55 +01:00
|
|
|
|
2019-01-27 08:25:10 +01:00
|
|
|
event = event_fixtures.realm__update_dict__night_logo;
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_night_logo_url, "night_logo.png");
|
|
|
|
assert_same(realm.realm_night_logo_source, "U");
|
2019-01-27 08:25:10 +01:00
|
|
|
|
2018-08-19 01:34:26 +02:00
|
|
|
event = event_fixtures.realm__deactivated;
|
2020-07-15 01:29:15 +02:00
|
|
|
set_global("location", {});
|
2018-08-19 01:34:26 +02:00
|
|
|
dispatch(event);
|
|
|
|
assert_same(window.location.href, "/accounts/deactivated/");
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("realm_bot add", ({override}) => {
|
2021-02-11 16:36:12 +01:00
|
|
|
const event = event_fixtures.realm_bot__add;
|
2021-02-13 03:46:14 +01:00
|
|
|
const bot_stub = make_stub();
|
|
|
|
override(bot_data, "add", bot_stub.f);
|
2023-12-14 23:51:33 +01:00
|
|
|
override(settings_bots, "render_bots", noop);
|
2021-02-13 03:46:14 +01:00
|
|
|
dispatch(event);
|
|
|
|
|
|
|
|
assert.equal(bot_stub.num_calls, 1);
|
|
|
|
const args = bot_stub.get_args("bot");
|
|
|
|
assert_same(args.bot, event.bot);
|
2021-02-11 16:36:12 +01:00
|
|
|
});
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2022-03-19 09:34:42 +01:00
|
|
|
run_test("realm_bot delete", ({override}) => {
|
2021-02-11 16:36:12 +01:00
|
|
|
const event = event_fixtures.realm_bot__delete;
|
2022-03-19 09:34:42 +01:00
|
|
|
const bot_stub = make_stub();
|
|
|
|
override(bot_data, "del", bot_stub.f);
|
2023-12-14 23:51:33 +01:00
|
|
|
override(settings_bots, "render_bots", noop);
|
2022-03-19 09:34:42 +01:00
|
|
|
|
2020-05-28 22:29:52 +02:00
|
|
|
dispatch(event);
|
2022-03-19 09:34:42 +01:00
|
|
|
assert.equal(bot_stub.num_calls, 1);
|
|
|
|
const args = bot_stub.get_args("user_id");
|
|
|
|
assert_same(args.user_id, event.bot.user_id);
|
2021-02-11 16:36:12 +01:00
|
|
|
});
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("realm_bot update", ({override}) => {
|
2021-02-11 16:36:12 +01:00
|
|
|
const event = event_fixtures.realm_bot__update;
|
2021-02-13 03:46:14 +01:00
|
|
|
const bot_stub = make_stub();
|
|
|
|
override(bot_data, "update", bot_stub.f);
|
2023-12-14 23:51:33 +01:00
|
|
|
override(settings_bots, "render_bots", noop);
|
2017-03-11 19:18:57 +01:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
dispatch(event);
|
2017-03-11 19:18:57 +01:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(bot_stub.num_calls, 1);
|
2023-01-29 03:00:46 +01:00
|
|
|
const args = bot_stub.get_args("user_id", "bot");
|
2021-02-13 03:46:14 +01:00
|
|
|
assert_same(args.user_id, event.bot.user_id);
|
|
|
|
assert_same(args.bot, event.bot);
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("realm_emoji", ({override}) => {
|
2020-08-05 19:04:27 +02:00
|
|
|
const event = event_fixtures.realm_emoji__update;
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2020-07-25 14:27:39 +02:00
|
|
|
const ui_func_names = [
|
2021-02-11 01:23:23 +01:00
|
|
|
[settings_emoji, "populate_emoji"],
|
|
|
|
[emoji_picker, "rebuild_catalog"],
|
2020-07-25 14:27:39 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
const ui_stubs = [];
|
|
|
|
|
2021-02-11 01:23:23 +01:00
|
|
|
for (const [module, func_name] of ui_func_names) {
|
2020-12-01 00:06:06 +01:00
|
|
|
const ui_stub = make_stub();
|
2021-02-11 01:23:23 +01:00
|
|
|
override(module, func_name, ui_stub.f);
|
2020-07-25 14:27:39 +02:00
|
|
|
ui_stubs.push(ui_stub);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure we start with nothing...
|
2021-03-10 14:30:51 +01:00
|
|
|
emoji.update_emojis([]);
|
2020-07-25 14:27:39 +02:00
|
|
|
assert.equal(emoji.get_realm_emoji_url("spain"), undefined);
|
|
|
|
|
|
|
|
dispatch(event);
|
|
|
|
|
|
|
|
// Now emoji.js knows about the spain emoji.
|
2021-08-12 10:20:50 +02:00
|
|
|
assert_same(emoji.get_realm_emoji_url("spain"), "/some/path/to/spain.gif");
|
2020-07-25 14:27:39 +02:00
|
|
|
|
|
|
|
// Make sure our UI modules all got dispatched the same simple way.
|
|
|
|
for (const stub of ui_stubs) {
|
2021-06-03 16:42:03 +02:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2020-07-25 14:27:39 +02:00
|
|
|
assert.equal(stub.last_call_args.length, 0);
|
|
|
|
}
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("realm_linkifiers", ({override}) => {
|
2021-03-30 12:51:54 +02:00
|
|
|
const event = event_fixtures.realm_linkifiers;
|
2024-02-13 02:08:24 +01:00
|
|
|
realm.realm_linkifiers = [];
|
2021-03-13 18:15:14 +01:00
|
|
|
override(settings_linkifiers, "populate_linkifiers", noop);
|
2021-05-19 06:18:23 +02:00
|
|
|
override(linkifiers, "update_linkifier_rules", noop);
|
2016-08-05 21:44:51 +02:00
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_linkifiers, event.realm_linkifiers);
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("realm_playgrounds", ({override}) => {
|
2021-04-16 04:04:18 +02:00
|
|
|
const event = event_fixtures.realm_playgrounds;
|
2024-02-13 02:08:24 +01:00
|
|
|
realm.realm_playgrounds = [];
|
2021-04-16 04:04:18 +02:00
|
|
|
override(settings_playgrounds, "populate_playgrounds", noop);
|
|
|
|
override(realm_playground, "update_playgrounds", noop);
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_playgrounds, event.realm_playgrounds);
|
2021-04-16 04:04:18 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("realm_domains", ({override}) => {
|
2019-11-02 00:06:25 +01:00
|
|
|
let event = event_fixtures.realm_domains__add;
|
2024-02-13 02:08:24 +01:00
|
|
|
realm.realm_domains = [];
|
2021-07-20 14:51:48 +02:00
|
|
|
override(settings_org, "populate_realm_domains_label", noop);
|
|
|
|
override(settings_realm_domains, "populate_realm_domains_table", noop);
|
2017-05-31 07:02:00 +02:00
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_domains, [event.realm_domain]);
|
2017-05-31 07:02:00 +02:00
|
|
|
|
2021-07-20 14:51:48 +02:00
|
|
|
override(settings_org, "populate_realm_domains_label", noop);
|
|
|
|
override(settings_realm_domains, "populate_realm_domains_table", noop);
|
2017-05-31 07:02:00 +02:00
|
|
|
event = event_fixtures.realm_domains__change;
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_domains, [event.realm_domain]);
|
2017-05-31 07:02:00 +02:00
|
|
|
|
2021-07-20 14:51:48 +02:00
|
|
|
override(settings_org, "populate_realm_domains_label", noop);
|
|
|
|
override(settings_realm_domains, "populate_realm_domains_table", noop);
|
2017-05-31 07:02:00 +02:00
|
|
|
event = event_fixtures.realm_domains__remove;
|
|
|
|
dispatch(event);
|
2024-02-13 02:08:24 +01:00
|
|
|
assert_same(realm.realm_domains, []);
|
2017-05-31 07:02:00 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("realm_user", ({override}) => {
|
2022-12-20 16:52:25 +01:00
|
|
|
override(settings_account, "maybe_update_deactivate_account_button", noop);
|
2019-11-02 00:06:25 +01:00
|
|
|
let event = event_fixtures.realm_user__add;
|
2020-08-14 02:45:53 +02:00
|
|
|
dispatch({...event});
|
2020-02-05 14:30:59 +01:00
|
|
|
const added_person = people.get_by_user_id(event.person.user_id);
|
2020-08-14 02:45:53 +02:00
|
|
|
// sanity check a few individual fields
|
2020-07-25 22:15:45 +02:00
|
|
|
assert.equal(added_person.full_name, "Test User");
|
2020-10-27 01:41:00 +01:00
|
|
|
assert.equal(added_person.timezone, "America/New_York");
|
2020-08-14 02:45:53 +02:00
|
|
|
|
|
|
|
// ...but really the whole struct gets copied without any
|
|
|
|
// manipulation
|
|
|
|
assert.deepEqual(added_person, event.person);
|
|
|
|
|
2021-06-10 08:32:54 +02:00
|
|
|
assert.ok(people.is_active_user_for_popover(event.person.user_id));
|
2016-08-05 21:44:51 +02:00
|
|
|
|
|
|
|
event = event_fixtures.realm_user__update;
|
2021-02-13 03:46:14 +01:00
|
|
|
const stub = make_stub();
|
|
|
|
override(user_events, "update_person", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
2023-01-29 03:00:46 +01:00
|
|
|
let args = stub.get_args("person");
|
2021-02-13 03:46:14 +01:00
|
|
|
assert_same(args.person, event.person);
|
2023-03-02 12:21:13 +01:00
|
|
|
|
|
|
|
// Test bot related functions are being called.
|
|
|
|
const add_bot_stub = make_stub();
|
|
|
|
event = event_fixtures.realm_user__add_bot;
|
|
|
|
override(settings_users, "redraw_bots_list", add_bot_stub.f);
|
|
|
|
dispatch({...event});
|
|
|
|
assert.equal(add_bot_stub.num_calls, 1);
|
|
|
|
|
|
|
|
const update_bot_stub = make_stub();
|
|
|
|
event = event_fixtures.realm_user__update;
|
|
|
|
override(settings_users, "update_bot_data", update_bot_stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(update_bot_stub.num_calls, 1);
|
|
|
|
args = update_bot_stub.get_args("update_user_id", "update_bot_data");
|
2023-01-29 03:00:46 +01:00
|
|
|
assert_same(args.update_user_id, event.person.user_id);
|
2023-12-02 04:46:02 +01:00
|
|
|
|
|
|
|
event = event_fixtures.realm_user__remove;
|
|
|
|
dispatch(event);
|
|
|
|
const removed_person = people.get_by_user_id(event.person.user_id);
|
|
|
|
assert.equal(removed_person.full_name, "translated: Unknown user");
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2024-02-10 04:19:08 +01:00
|
|
|
run_test("restart", ({_override}) => {
|
2019-11-02 00:06:25 +01:00
|
|
|
const event = event_fixtures.restart;
|
2024-02-10 04:19:08 +01:00
|
|
|
dispatch(event);
|
|
|
|
assert_same(realm.zulip_version, event.zulip_version);
|
|
|
|
assert_same(realm.zulip_merge_base, event.zulip_merge_base);
|
|
|
|
});
|
|
|
|
|
|
|
|
run_test("web_reload_client", ({override}) => {
|
|
|
|
const event = event_fixtures.web_reload_client;
|
2021-02-13 03:46:14 +01:00
|
|
|
const stub = make_stub();
|
|
|
|
override(reload, "initiate", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("options");
|
|
|
|
assert.equal(args.options.immediate, true);
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("submessage", ({override}) => {
|
2019-11-02 00:06:25 +01:00
|
|
|
const event = event_fixtures.submessage;
|
2021-02-13 03:46:14 +01:00
|
|
|
const stub = make_stub();
|
|
|
|
override(submessage, "handle_event", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const submsg = stub.get_args("submsg").submsg;
|
|
|
|
assert_same(submsg, {
|
|
|
|
id: 99,
|
|
|
|
sender_id: 42,
|
|
|
|
msg_type: "stream",
|
|
|
|
message_id: 56,
|
|
|
|
content: "test",
|
2018-08-19 00:02:08 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-02-22 23:04:10 +01:00
|
|
|
// For subscriptions, see dispatch_subs.test.js
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("typing", ({override}) => {
|
2021-03-10 14:30:51 +01:00
|
|
|
// Simulate that we are not typing.
|
2024-02-13 02:08:16 +01:00
|
|
|
current_user.user_id = typing_person1.user_id + 1;
|
2021-03-10 14:30:51 +01:00
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
let event = event_fixtures.typing__start;
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-02-11 01:23:23 +01:00
|
|
|
override(typing_events, "display_notification", stub.f);
|
2017-05-31 07:48:38 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2020-07-15 01:29:15 +02:00
|
|
|
const args = stub.get_args("event");
|
2020-07-25 22:58:18 +02:00
|
|
|
assert_same(args.event.sender.user_id, typing_person1.user_id);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2017-05-31 07:48:38 +02:00
|
|
|
|
|
|
|
event = event_fixtures.typing__stop;
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-02-11 01:23:23 +01:00
|
|
|
override(typing_events, "hide_notification", stub.f);
|
2017-05-31 07:48:38 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2020-07-15 01:29:15 +02:00
|
|
|
const args = stub.get_args("event");
|
2020-07-25 22:58:18 +02:00
|
|
|
assert_same(args.event.sender.user_id, typing_person1.user_id);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2018-08-18 23:26:21 +02:00
|
|
|
|
2021-03-10 14:30:51 +01:00
|
|
|
// Get line coverage--we ignore our own typing events.
|
2024-02-13 02:08:16 +01:00
|
|
|
current_user.user_id = typing_person1.user_id;
|
2020-07-25 22:58:18 +02:00
|
|
|
event = event_fixtures.typing__start;
|
2021-03-10 14:30:51 +01:00
|
|
|
dispatch(event);
|
2024-02-13 02:08:16 +01:00
|
|
|
current_user.user_id = undefined; // above change shouldn't effect stream_typing tests below
|
2021-01-04 16:21:54 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
run_test("stream_typing", ({override}) => {
|
|
|
|
const stream_typing_in_id = events.stream_typing_in_id;
|
|
|
|
const topic_typing_in = events.topic_typing_in;
|
|
|
|
let event = event_fixtures.stream_typing__start;
|
|
|
|
{
|
|
|
|
const stub = make_stub();
|
|
|
|
override(typing_events, "display_notification", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("event");
|
|
|
|
assert_same(args.event.sender.user_id, typing_person1.user_id);
|
|
|
|
assert_same(args.event.message_type, "stream");
|
|
|
|
assert_same(args.event.stream_id, stream_typing_in_id);
|
|
|
|
assert_same(args.event.topic, topic_typing_in);
|
|
|
|
}
|
|
|
|
|
|
|
|
event = event_fixtures.stream_typing__stop;
|
|
|
|
{
|
|
|
|
const stub = make_stub();
|
|
|
|
override(typing_events, "hide_notification", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("event");
|
|
|
|
assert_same(args.event.sender.user_id, typing_person1.user_id);
|
|
|
|
assert_same(args.event.message_type, "stream");
|
|
|
|
assert_same(args.event.stream_id, stream_typing_in_id);
|
|
|
|
assert_same(args.event.topic, topic_typing_in);
|
|
|
|
}
|
2017-05-31 07:48:38 +02:00
|
|
|
});
|
|
|
|
|
2022-07-10 01:06:33 +02:00
|
|
|
run_test("user_settings", ({override}) => {
|
2024-01-09 20:36:02 +01:00
|
|
|
settings_preferences.set_default_language_name = () => {};
|
2021-07-27 19:02:05 +02:00
|
|
|
let event = event_fixtures.user_settings__default_language;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.default_language = "en";
|
2024-01-09 20:36:02 +01:00
|
|
|
override(settings_preferences, "update_page", noop);
|
2024-03-28 21:00:04 +01:00
|
|
|
override(message_lists, "calculate_timestamp_widths", noop);
|
2023-05-25 22:30:20 +02:00
|
|
|
override(overlays, "settings_open", () => true);
|
2016-08-05 21:44:51 +02:00
|
|
|
dispatch(event);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert_same(user_settings.default_language, "fr");
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2023-10-23 09:02:57 +02:00
|
|
|
event = event_fixtures.user_settings__web_escape_navigates_to_home_view;
|
|
|
|
user_settings.web_escape_navigates_to_home_view = false;
|
2021-10-25 19:17:19 +02:00
|
|
|
let toggled = [];
|
2023-10-23 09:02:57 +02:00
|
|
|
$("#go-to-home-view-hotkey-help").toggleClass = (cls) => {
|
2021-10-25 19:17:19 +02:00
|
|
|
toggled.push(cls);
|
|
|
|
};
|
|
|
|
dispatch(event);
|
2023-10-23 09:02:57 +02:00
|
|
|
assert_same(user_settings.web_escape_navigates_to_home_view, true);
|
2021-10-25 19:17:19 +02:00
|
|
|
assert_same(toggled, ["notdisplayed"]);
|
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
let called = false;
|
2021-03-30 02:21:21 +02:00
|
|
|
message_lists.current.rerender = () => {
|
2018-08-19 01:59:34 +02:00
|
|
|
called = true;
|
|
|
|
};
|
2024-04-21 05:31:35 +02:00
|
|
|
let called_for_cached_msg_list = false;
|
|
|
|
cached_message_list.rerender = () => {
|
|
|
|
called_for_cached_msg_list = true;
|
|
|
|
};
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__twenty_four_hour_time;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.twenty_four_hour_time = false;
|
2016-08-05 21:44:51 +02:00
|
|
|
dispatch(event);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert_same(user_settings.twenty_four_hour_time, true);
|
2018-08-19 01:59:34 +02:00
|
|
|
assert_same(called, true);
|
2024-04-21 05:31:35 +02:00
|
|
|
assert_same(called_for_cached_msg_list, true);
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__translate_emoticons;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.translate_emoticons = false;
|
2018-01-15 19:36:32 +01:00
|
|
|
dispatch(event);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert_same(user_settings.translate_emoticons, true);
|
2018-08-19 01:59:34 +02:00
|
|
|
|
2022-04-20 04:46:36 +02:00
|
|
|
event = event_fixtures.user_settings__display_emoji_reaction_users;
|
|
|
|
user_settings.display_emoji_reaction_users = false;
|
|
|
|
dispatch(event);
|
|
|
|
assert_same(user_settings.display_emoji_reaction_users, true);
|
|
|
|
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__high_contrast_mode;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.high_contrast_mode = false;
|
2021-10-25 19:17:19 +02:00
|
|
|
toggled = [];
|
2018-08-19 01:59:34 +02:00
|
|
|
$("body").toggleClass = (cls) => {
|
|
|
|
toggled.push(cls);
|
|
|
|
};
|
|
|
|
dispatch(event);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert_same(user_settings.high_contrast_mode, true);
|
2020-07-15 01:29:15 +02:00
|
|
|
assert_same(toggled, ["high-contrast"]);
|
2018-08-19 01:59:34 +02:00
|
|
|
|
2023-03-08 02:27:45 +01:00
|
|
|
event = event_fixtures.user_settings__web_mark_read_on_scroll_policy;
|
|
|
|
user_settings.web_mark_read_on_scroll_policy = 3;
|
|
|
|
override(unread_ui, "update_unread_banner", noop);
|
|
|
|
dispatch(event);
|
|
|
|
assert_same(user_settings.web_mark_read_on_scroll_policy, 1);
|
|
|
|
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__dense_mode;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.dense_mode = false;
|
2018-08-19 01:59:34 +02:00
|
|
|
toggled = [];
|
|
|
|
dispatch(event);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert_same(user_settings.dense_mode, true);
|
2024-04-25 18:38:45 +02:00
|
|
|
assert_same(toggled, ["less-dense-mode", "more-dense-mode"]);
|
2018-08-19 01:59:34 +02:00
|
|
|
|
2024-04-02 18:28:21 +02:00
|
|
|
event = event_fixtures.user_settings__web_font_size_px;
|
|
|
|
user_settings.web_font_size_px = 14;
|
|
|
|
override(information_density, "set_base_typography_css_variables", noop);
|
|
|
|
dispatch(event);
|
|
|
|
assert_same(user_settings.web_font_size_px, 16);
|
|
|
|
|
|
|
|
event = event_fixtures.user_settings__web_line_height_percent;
|
|
|
|
user_settings.web_font_size_px = 122;
|
|
|
|
override(information_density, "set_base_typography_css_variables", noop);
|
|
|
|
dispatch(event);
|
|
|
|
assert_same(user_settings.web_line_height_percent, 130);
|
|
|
|
|
2021-07-19 13:49:40 +02:00
|
|
|
override(realm_logo, "render", noop);
|
2021-02-11 16:36:12 +01:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__color_scheme_dark;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.color_scheme = 1;
|
2021-11-26 08:36:54 +01:00
|
|
|
override(dark_theme, "enable", stub.f); // automatically checks if called
|
2018-08-19 01:59:34 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert.equal(user_settings.color_scheme, 2);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2018-08-19 01:59:34 +02:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__color_scheme_light;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.color_scheme = 1;
|
2021-11-26 08:36:54 +01:00
|
|
|
override(dark_theme, "disable", stub.f); // automatically checks if called
|
2020-05-16 13:13:59 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert.equal(user_settings.color_scheme, 3);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2020-05-16 13:13:59 +02:00
|
|
|
|
2021-03-10 13:56:10 +01:00
|
|
|
{
|
2023-10-23 09:02:57 +02:00
|
|
|
event = event_fixtures.user_settings__web_home_view_recent_topics;
|
|
|
|
user_settings.web_home_view = "all_messages";
|
2021-03-10 13:56:10 +01:00
|
|
|
dispatch(event);
|
2023-10-23 09:02:57 +02:00
|
|
|
assert.equal(user_settings.web_home_view, "recent_topics");
|
2021-03-10 13:56:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2023-10-23 09:02:57 +02:00
|
|
|
event = event_fixtures.user_settings__web_home_view_all_messages;
|
|
|
|
user_settings.web_home_view = "recent_topics";
|
2021-03-10 13:56:10 +01:00
|
|
|
dispatch(event);
|
2023-10-23 09:02:57 +02:00
|
|
|
assert.equal(user_settings.web_home_view, "all_messages");
|
2021-03-10 13:56:10 +01:00
|
|
|
}
|
|
|
|
|
2023-10-23 21:12:18 +02:00
|
|
|
{
|
2023-10-23 09:02:57 +02:00
|
|
|
event = event_fixtures.user_settings__web_home_view_inbox;
|
|
|
|
user_settings.web_home_view = "all_messages";
|
2023-10-23 21:12:18 +02:00
|
|
|
dispatch(event);
|
2023-10-23 09:02:57 +02:00
|
|
|
assert.equal(user_settings.web_home_view, "inbox");
|
2023-10-23 21:12:18 +02:00
|
|
|
}
|
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__color_scheme_automatic;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.color_scheme = 2;
|
2021-11-26 08:36:54 +01:00
|
|
|
override(dark_theme, "default_preference_checker", stub.f); // automatically checks if called
|
2018-08-19 01:59:34 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert.equal(user_settings.color_scheme, 1);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2018-08-19 01:59:34 +02:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__emojiset;
|
2018-08-19 01:59:34 +02:00
|
|
|
called = false;
|
2024-01-09 20:36:02 +01:00
|
|
|
override(settings_preferences, "report_emojiset_change", stub.f);
|
2023-10-05 10:20:16 +02:00
|
|
|
override(activity_ui, "build_user_sidebar", noop);
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.emojiset = "text";
|
2018-08-19 01:59:34 +02:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2018-08-19 01:59:34 +02:00
|
|
|
assert_same(called, true);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert_same(user_settings.emojiset, "google");
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2019-01-25 21:33:02 +01:00
|
|
|
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__starred_message_counts;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.starred_message_counts = false;
|
2019-01-25 21:33:02 +01:00
|
|
|
dispatch(event);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert_same(user_settings.starred_message_counts, true);
|
2019-04-16 18:46:17 +02:00
|
|
|
|
2024-04-12 19:30:29 +02:00
|
|
|
event = event_fixtures.user_settings__receives_typing_notifications;
|
|
|
|
user_settings.receives_typing_notifications = false;
|
|
|
|
dispatch(event);
|
|
|
|
assert_same(user_settings.receives_typing_notifications, true);
|
|
|
|
|
|
|
|
event = event_fixtures.user_settings__receives_typing_notifications_disabled;
|
|
|
|
override(typing_events, "disable_typing_notification", noop);
|
|
|
|
user_settings.receives_typing_notifications = true;
|
|
|
|
dispatch(event);
|
|
|
|
assert_same(user_settings.receives_typing_notifications, false);
|
|
|
|
|
2021-02-11 01:23:23 +01:00
|
|
|
override(scroll_bar, "set_layout_width", noop);
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__fluid_layout_width;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.fluid_layout_width = false;
|
2019-04-16 18:46:17 +02:00
|
|
|
dispatch(event);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert_same(user_settings.fluid_layout_width, true);
|
2019-03-17 14:48:51 +01:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__demote_inactive_streams;
|
2023-04-24 07:37:18 +02:00
|
|
|
override(stream_list_sort, "set_filter_out_inactives", noop);
|
2022-07-10 01:06:33 +02:00
|
|
|
override(stream_list, "update_streams_sidebar", stub.f);
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.demote_inactive_streams = 1;
|
2019-03-17 14:48:51 +01:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert_same(user_settings.demote_inactive_streams, 2);
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2021-07-26 21:55:14 +02:00
|
|
|
|
2023-04-25 13:37:16 +02:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
|
|
|
event = event_fixtures.user_settings__web_stream_unreads_count_display_policy;
|
|
|
|
override(stream_list, "update_dom_unread_counts_visibility", stub.f);
|
|
|
|
user_settings.web_stream_unreads_count_display_policy = 1;
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
assert_same(user_settings.web_stream_unreads_count_display_policy, 2);
|
|
|
|
}
|
|
|
|
|
2022-08-12 22:41:06 +02:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
|
|
|
event = event_fixtures.user_settings__user_list_style;
|
2024-01-09 20:36:02 +01:00
|
|
|
override(settings_preferences, "report_user_list_style_change", stub.f);
|
2022-08-12 22:41:06 +02:00
|
|
|
user_settings.user_list_style = 1;
|
2023-10-05 10:20:16 +02:00
|
|
|
override(activity_ui, "build_user_sidebar", stub.f);
|
2022-08-12 22:41:06 +02:00
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 2);
|
|
|
|
assert_same(user_settings.user_list_style, 2);
|
|
|
|
}
|
|
|
|
|
2021-07-27 19:02:05 +02:00
|
|
|
event = event_fixtures.user_settings__enter_sends;
|
2021-07-28 16:00:58 +02:00
|
|
|
user_settings.enter_sends = false;
|
2021-07-26 21:55:14 +02:00
|
|
|
dispatch(event);
|
2021-07-28 16:00:58 +02:00
|
|
|
assert_same(user_settings.enter_sends, true);
|
2016-08-05 21:44:51 +02:00
|
|
|
|
2022-09-20 20:49:22 +02:00
|
|
|
event = event_fixtures.user_settings__presence_disabled;
|
2021-09-17 13:14:04 +02:00
|
|
|
user_settings.presence_enabled = true;
|
2023-10-05 10:20:16 +02:00
|
|
|
override(activity_ui, "redraw_user", noop);
|
2021-09-17 13:14:04 +02:00
|
|
|
dispatch(event);
|
|
|
|
assert_same(user_settings.presence_enabled, false);
|
2022-09-20 20:49:22 +02:00
|
|
|
|
|
|
|
event = event_fixtures.user_settings__presence_enabled;
|
2023-10-05 10:20:16 +02:00
|
|
|
override(activity_ui, "redraw_user", noop);
|
2022-09-20 20:49:22 +02:00
|
|
|
dispatch(event);
|
|
|
|
assert_same(user_settings.presence_enabled, true);
|
2021-09-17 13:14:04 +02:00
|
|
|
|
2021-07-27 19:02:05 +02:00
|
|
|
{
|
|
|
|
event = event_fixtures.user_settings__enable_stream_audible_notifications;
|
|
|
|
const stub = make_stub();
|
2023-06-01 01:19:38 +02:00
|
|
|
override(stream_ui_updates, "update_notification_setting_checkbox", stub.f);
|
2021-07-27 19:02:05 +02:00
|
|
|
override(settings_notifications, "update_page", noop);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
2023-06-01 01:19:38 +02:00
|
|
|
const args = stub.get_args("notification_name");
|
|
|
|
assert_same(args.notification_name, "audible_notifications");
|
2021-07-27 19:02:05 +02:00
|
|
|
}
|
2023-03-27 16:49:14 +02:00
|
|
|
|
2023-06-01 01:19:38 +02:00
|
|
|
event = event_fixtures.user_settings__notification_sound;
|
2023-10-07 00:09:47 +02:00
|
|
|
override(audible_notifications, "update_notification_sound_source", noop);
|
2023-06-01 01:19:38 +02:00
|
|
|
dispatch(event);
|
|
|
|
|
2023-03-27 16:49:14 +02:00
|
|
|
event = event_fixtures.user_settings__email_address_visibility;
|
|
|
|
user_settings.email_address_visibility = 3;
|
|
|
|
dispatch(event);
|
|
|
|
assert_same(user_settings.email_address_visibility, 5);
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("update_message (read)", ({override}) => {
|
2019-11-02 00:06:25 +01:00
|
|
|
const event = event_fixtures.update_message_flags__read;
|
2017-03-11 19:18:57 +01:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
const stub = make_stub();
|
|
|
|
override(unread_ops, "process_read_messages_event", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("message_ids");
|
|
|
|
assert_same(args.message_ids, [999]);
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
|
|
|
|
2021-06-09 13:31:39 +02:00
|
|
|
run_test("update_message (unread)", ({override}) => {
|
|
|
|
const event = event_fixtures.update_message_flags__read_remove;
|
|
|
|
|
|
|
|
const stub = make_stub();
|
|
|
|
override(unread_ops, "process_unread_messages_event", stub.f);
|
|
|
|
dispatch(event);
|
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const {args} = stub.get_args("args");
|
|
|
|
assert.deepEqual(args, {
|
|
|
|
message_ids: event.messages,
|
|
|
|
message_details: event.message_details,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-04-25 05:36:10 +02:00
|
|
|
run_test("update_message (add star)", () => {
|
2021-02-11 16:36:12 +01:00
|
|
|
const event = event_fixtures.update_message_flags__starred_add;
|
2021-02-13 03:46:14 +01:00
|
|
|
dispatch(event);
|
|
|
|
const msg = message_store.get(test_message.id);
|
|
|
|
assert.equal(msg.starred, true);
|
2021-02-11 16:36:12 +01:00
|
|
|
});
|
2019-01-26 19:28:39 +01:00
|
|
|
|
2023-04-25 05:36:10 +02:00
|
|
|
run_test("update_message (remove star)", () => {
|
2021-02-11 16:36:12 +01:00
|
|
|
const event = event_fixtures.update_message_flags__starred_remove;
|
2021-02-13 03:46:14 +01:00
|
|
|
dispatch(event);
|
|
|
|
const msg = message_store.get(test_message.id);
|
|
|
|
assert.equal(msg.starred, false);
|
2016-08-05 21:44:51 +02:00
|
|
|
});
|
2017-05-31 07:20:28 +02:00
|
|
|
|
2022-07-10 01:06:33 +02:00
|
|
|
run_test("update_message (wrong data)", () => {
|
2021-04-03 17:56:08 +02:00
|
|
|
const event = {
|
|
|
|
...event_fixtures.update_message_flags__starred_add,
|
|
|
|
messages: [0], // message does not exist
|
|
|
|
};
|
2021-03-20 08:33:28 +01:00
|
|
|
dispatch(event);
|
|
|
|
// update_starred_view never gets invoked, early return is successful
|
|
|
|
});
|
|
|
|
|
2022-07-10 01:06:33 +02:00
|
|
|
run_test("delete_message", ({override}) => {
|
2019-11-02 00:06:25 +01:00
|
|
|
const event = event_fixtures.delete_message;
|
2018-02-16 23:41:38 +01:00
|
|
|
|
2022-07-10 01:06:33 +02:00
|
|
|
override(stream_list, "update_streams_sidebar", noop);
|
2021-02-11 16:36:12 +01:00
|
|
|
|
|
|
|
const message_events_stub = make_stub();
|
|
|
|
override(message_events, "remove_messages", message_events_stub.f);
|
|
|
|
|
|
|
|
const unread_ops_stub = make_stub();
|
|
|
|
override(unread_ops, "process_read_messages_event", unread_ops_stub.f);
|
|
|
|
|
|
|
|
const stream_topic_history_stub = make_stub();
|
2022-07-10 01:06:33 +02:00
|
|
|
override(stream_topic_history, "remove_messages", stream_topic_history_stub.f);
|
2021-02-11 16:36:12 +01:00
|
|
|
|
|
|
|
dispatch(event);
|
|
|
|
|
|
|
|
let args;
|
|
|
|
|
|
|
|
args = message_events_stub.get_args("message_ids");
|
|
|
|
assert_same(args.message_ids, [1337]);
|
|
|
|
|
|
|
|
args = unread_ops_stub.get_args("message_ids");
|
|
|
|
assert_same(args.message_ids, [1337]);
|
|
|
|
|
|
|
|
args = stream_topic_history_stub.get_args("opts");
|
|
|
|
assert_same(args.opts.stream_id, 99);
|
|
|
|
assert_same(args.opts.topic_name, "topic1");
|
|
|
|
assert_same(args.opts.num_messages, 1);
|
|
|
|
assert_same(args.opts.max_removed_msg_id, 1337);
|
2017-05-31 07:20:28 +02:00
|
|
|
});
|
2018-12-19 18:41:47 +01:00
|
|
|
|
2022-07-10 01:06:33 +02:00
|
|
|
run_test("user_status", ({override}) => {
|
2022-09-21 15:49:36 +02:00
|
|
|
let event = event_fixtures.user_status__set_status_emoji;
|
2021-06-27 19:04:17 +02:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2023-10-05 10:20:16 +02:00
|
|
|
override(activity_ui, "redraw_user", stub.f);
|
2023-09-19 08:13:40 +02:00
|
|
|
override(compose_pm_pill, "get_user_ids", () => [event.user_id]);
|
2022-09-13 13:15:57 +02:00
|
|
|
override(pm_list, "update_private_messages", noop);
|
2021-06-27 19:04:17 +02:00
|
|
|
dispatch(event);
|
2023-09-19 08:13:40 +02:00
|
|
|
assert.equal(stub.num_calls, 2);
|
2021-06-27 19:04:17 +02:00
|
|
|
const args = stub.get_args("user_id");
|
|
|
|
assert_same(args.user_id, test_user.user_id);
|
|
|
|
const emoji_info = user_status.get_status_emoji(test_user.user_id);
|
|
|
|
assert.deepEqual(emoji_info, {
|
|
|
|
emoji_name: "smiley",
|
|
|
|
emoji_code: "1f603",
|
|
|
|
reaction_type: "unicode_emoji",
|
|
|
|
// Extra parameters that were added by `emoji.get_emoji_details_by_name`
|
|
|
|
emoji_alt_code: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-01-26 19:29:06 +01:00
|
|
|
event = event_fixtures.user_status__set_status_text;
|
2021-02-13 03:46:14 +01:00
|
|
|
{
|
|
|
|
const stub = make_stub();
|
2023-10-05 10:20:16 +02:00
|
|
|
override(activity_ui, "redraw_user", stub.f);
|
2022-07-10 01:06:33 +02:00
|
|
|
override(compose_pm_pill, "get_user_ids", () => [event.user_id]);
|
2019-01-26 19:29:06 +01:00
|
|
|
dispatch(event);
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
2020-07-15 01:29:15 +02:00
|
|
|
const args = stub.get_args("user_id");
|
2019-01-26 19:29:06 +01:00
|
|
|
assert_same(args.user_id, test_user.user_id);
|
2019-11-02 00:06:25 +01:00
|
|
|
const status_text = user_status.get_status_text(test_user.user_id);
|
2020-07-15 01:29:15 +02:00
|
|
|
assert.equal(status_text, "out to lunch");
|
2021-02-13 03:46:14 +01:00
|
|
|
}
|
2018-12-19 18:41:47 +01:00
|
|
|
});
|
2019-04-09 21:49:07 +02:00
|
|
|
|
2021-06-16 14:38:37 +02:00
|
|
|
run_test("realm_export", ({override}) => {
|
2019-11-02 00:06:25 +01:00
|
|
|
const event = event_fixtures.realm_export;
|
2021-02-13 03:46:14 +01:00
|
|
|
const stub = make_stub();
|
|
|
|
override(settings_exports, "populate_exports_table", stub.f);
|
|
|
|
dispatch(event);
|
2019-04-09 21:49:07 +02:00
|
|
|
|
2021-02-13 03:46:14 +01:00
|
|
|
assert.equal(stub.num_calls, 1);
|
|
|
|
const args = stub.get_args("exports");
|
|
|
|
assert.equal(args.exports, event.exports);
|
2019-04-09 21:49:07 +02:00
|
|
|
});
|
2020-06-20 21:14:09 +02:00
|
|
|
|
2023-12-06 10:42:25 +01:00
|
|
|
run_test("server_event_dispatch_op_errors", () => {
|
2020-06-20 21:14:09 +02:00
|
|
|
blueslip.expect("error", "Unexpected event type subscription/other");
|
|
|
|
server_events_dispatch.dispatch_normal_event({type: "subscription", op: "other"});
|
2021-03-24 13:20:01 +01:00
|
|
|
blueslip.expect("error", "Unexpected event type reaction/other");
|
|
|
|
server_events_dispatch.dispatch_normal_event({type: "reaction", op: "other"});
|
2020-10-15 13:51:21 +02:00
|
|
|
blueslip.expect("error", "Unexpected event type realm/update_dict/other");
|
|
|
|
server_events_dispatch.dispatch_normal_event({
|
|
|
|
type: "realm",
|
|
|
|
op: "update_dict",
|
|
|
|
property: "other",
|
|
|
|
});
|
2020-10-15 14:11:54 +02:00
|
|
|
blueslip.expect("error", "Unexpected event type realm_bot/other");
|
|
|
|
server_events_dispatch.dispatch_normal_event({type: "realm_bot", op: "other"});
|
2020-10-15 16:34:13 +02:00
|
|
|
blueslip.expect("error", "Unexpected event type realm_domains/other");
|
|
|
|
server_events_dispatch.dispatch_normal_event({type: "realm_domains", op: "other"});
|
2020-10-16 03:55:11 +02:00
|
|
|
blueslip.expect("error", "Unexpected event type realm_user/other");
|
|
|
|
server_events_dispatch.dispatch_normal_event({type: "realm_user", op: "other"});
|
2020-10-16 04:13:38 +02:00
|
|
|
blueslip.expect("error", "Unexpected event type stream/other");
|
|
|
|
server_events_dispatch.dispatch_normal_event({type: "stream", op: "other"});
|
2020-10-16 04:28:43 +02:00
|
|
|
blueslip.expect("error", "Unexpected event type typing/other");
|
|
|
|
server_events_dispatch.dispatch_normal_event({
|
|
|
|
type: "typing",
|
|
|
|
sender: {user_id: 5},
|
|
|
|
op: "other",
|
|
|
|
});
|
|
|
|
blueslip.expect("error", "Unexpected event type user_group/other");
|
|
|
|
server_events_dispatch.dispatch_normal_event({type: "user_group", op: "other"});
|
2020-06-20 21:14:09 +02:00
|
|
|
});
|
2021-08-30 16:26:38 +02:00
|
|
|
|
|
|
|
run_test("realm_user_settings_defaults", ({override}) => {
|
2021-09-16 12:47:12 +02:00
|
|
|
let event = event_fixtures.realm_user_settings_defaults__emojiset;
|
2021-08-30 16:26:38 +02:00
|
|
|
realm_user_settings_defaults.emojiset = "text";
|
2021-10-02 13:34:52 +02:00
|
|
|
override(settings_realm_user_settings_defaults, "update_page", noop);
|
2021-08-30 16:26:38 +02:00
|
|
|
dispatch(event);
|
|
|
|
assert_same(realm_user_settings_defaults.emojiset, "google");
|
2021-09-16 12:47:12 +02:00
|
|
|
|
|
|
|
event = event_fixtures.realm_user_settings_defaults__notification_sound;
|
|
|
|
realm_user_settings_defaults.notification_sound = "zulip";
|
2021-10-02 13:34:52 +02:00
|
|
|
let called = false;
|
2023-10-07 00:09:47 +02:00
|
|
|
audible_notifications.update_notification_sound_source = () => {
|
2021-09-16 12:47:12 +02:00
|
|
|
called = true;
|
|
|
|
};
|
|
|
|
dispatch(event);
|
|
|
|
assert_same(realm_user_settings_defaults.notification_sound, "ding");
|
|
|
|
assert_same(called, true);
|
2021-08-30 16:26:38 +02:00
|
|
|
});
|