Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
eslint: Fix unicorn/no-immediate-mutation.
Anders Kaseorg55293f57a8eb
diff --git a/web/src/emoji_picker.ts b/web/src/emoji_picker.tsindex 7326a3c6cc2..05c8b058e43 100644--- a/web/src/emoji_picker.ts+++ b/web/src/emoji_picker.ts@@ -146,13 +146,14 @@ function show_emoji_catalog(): void {export function rebuild_catalog(): void {const realm_emojis = emoji.active_realm_emojis;- const catalog = new Map<string, EmojiDict[]>();- catalog.set(- "Custom",- [...realm_emojis.keys()].map(- (realm_emoji_name) => emoji.emojis_by_name.get(realm_emoji_name)!,- ),- );+ const catalog = new Map([+ [+ "Custom",+ [...realm_emojis.keys()].map(+ (realm_emoji_name) => emoji.emojis_by_name.get(realm_emoji_name)!,+ ),+ ],+ ]);for (const [category, raw_codepoints] of Object.entries(emoji_codes.emoji_catalog)) {const codepoints = z.array(z.string()).parse(raw_codepoints);diff --git a/web/src/personal_menu_popover.ts b/web/src/personal_menu_popover.tsindex 5a21dd92ab1..70516ac703b 100644--- a/web/src/personal_menu_popover.ts+++ b/web/src/personal_menu_popover.ts@@ -116,8 +116,7 @@ export function initialize(): void {$(this),changed_property,);- const data: Record<string, number> = {};- data[changed_property] = new_setting_value;+ const data = {[changed_property]: new_setting_value};information_density.enable_or_disable_control_buttons($popper);if (changed_property === "web_font_size_px") {diff --git a/web/src/portico/integrations.ts b/web/src/portico/integrations.tsindex 38ccb7d6b4e..d885c3ceefb 100644--- a/web/src/portico/integrations.ts+++ b/web/src/portico/integrations.ts@@ -231,8 +231,7 @@ function hide_integration_show_catalog(): void {}function get_state_from_path(): State {- const result = {...INITIAL_STATE};- result.query = state.query;+ const result = {...INITIAL_STATE, query: state.query};const parts = path_parts();if (parts[1] === "doc" && parts[2] !== undefined && INTEGRATIONS.get(parts[2])) {diff --git a/web/src/settings_preferences.ts b/web/src/settings_preferences.tsindex 8f78386dfca..0acacafc7ef 100644--- a/web/src/settings_preferences.ts+++ b/web/src/settings_preferences.ts@@ -284,8 +284,7 @@ export function set_up(settings_panel: SettingsPanel): void {changed_property,true,);- const data: Record<string, number> = {};- data[changed_property] = new_value;+ const data = {[changed_property]: new_value};const $status_element = $(this).closest(".subsection-parent").find(".alert-notification");information_density.enable_or_disable_control_buttons($container);@@ -306,7 +305,6 @@ export function set_up(settings_panel: SettingsPanel): void {const $input_elem = $(this);const new_theme_code = $input_elem.val();assert(new_theme_code !== undefined);- const data = {color_scheme: new_theme_code};const $status_element = $input_elem.closest(".subsection-parent")@@ -329,7 +327,7 @@ export function set_up(settings_panel: SettingsPanel): void {settings_ui.do_settings_change(channel.patch,"/json/settings",- data,+ {color_scheme: new_theme_code},$status_element,opts,);diff --git a/web/src/stream_edit.ts b/web/src/stream_edit.tsindex 630a1d09359..d2265e016c2 100644--- a/web/src/stream_edit.ts+++ b/web/src/stream_edit.ts@@ -422,10 +422,10 @@ function show_stream_email_address_modal(address: string, sub: StreamSubscriptioname: string;unique_id: number;}[] {- const senders: (User | CurrentUser | Bot)[] = [people.EMAIL_GATEWAY_BOT];- senders.push(+ const senders = [+ people.EMAIL_GATEWAY_BOT,...stream_data.get_current_user_and_their_bots_with_post_messages_permission(sub),- );+ ];return senders.map((sender) => ({name: update_option_label(sender),unique_id: sender.user_id,diff --git a/web/tests/activity.test.cjs b/web/tests/activity.test.cjsindex 0847b919c09..acffcbfea39 100644--- a/web/tests/activity.test.cjs+++ b/web/tests/activity.test.cjs@@ -274,8 +274,7 @@ test("direct_message_update_dom_counts", () => {$li.set_find_results(".unread_count", $count);$count.set_parents_result("li", $li);- const counts = new Map();- counts.set(pm_key, 5);+ const counts = new Map([[pm_key, 5]]);$li.addClass("user_sidebar_entry");activity_ui.update_dom_with_unread_counts({pm_count: counts});diff --git a/web/tests/components.test.cjs b/web/tests/components.test.cjsindex 3307c6a5489..398e13afc17 100644--- a/web/tests/components.test.cjs+++ b/web/tests/components.test.cjs@@ -61,64 +61,60 @@ function make_tab(i) {}const ind_tab = (function () {- const $self = {};-- $self.stub = true;+ return {+ stub: true,++ on(name, f) {+ if (name === "click") {+ env.click_f = f;+ } else if (name === "keydown") {+ env.keydown_f = f;+ }+ },- $self.on = (name, f) => {- if (name === "click") {- env.click_f = f;- } else if (name === "keydown") {- env.keydown_f = f;- }- };+ off(name) {+ if (name === "click") {+ env.click_f = undefined;+ }+ },- $self.off = (name) => {- if (name === "click") {- env.click_f = undefined;- }- };+ removeClass(c) {+ for (const $tab of env.tabs) {+ $tab.removeClass(c);+ }+ },- $self.removeClass = (c) => {- for (const $tab of env.tabs) {- $tab.removeClass(c);- }+ eq: (idx) => env.tabs[idx],};-- $self.eq = (idx) => env.tabs[idx];-- return $self;})();function make_switcher() {- const $self = {};-- $self.stub = true;+ return {+ stub: true,- $self.children = [];+ children: [],- $self.classList = new Set();+ classList: new Set(),- $self.append = (child) => {- $self.children.push(child);- };+ append(child) {+ this.children.push(child);+ },- $self.addClass = (c) => {- $self.classList.add(c);- $self.addedClass = c;- };+ addClass(c) {+ this.classList.add(c);+ this.addedClass = c;+ },- $self.find = (sel) => {- switch (sel) {- case ".ind-tab":- return ind_tab;- /* istanbul ignore next */- default:- throw new Error("unknown selector: " + sel);- }+ find(sel) {+ switch (sel) {+ case ".ind-tab":+ return ind_tab;+ /* istanbul ignore next */+ default:+ throw new Error("unknown selector: " + sel);+ }+ },};-- return $self;}mock_jquery((sel) => {diff --git a/web/tests/compose.test.cjs b/web/tests/compose.test.cjsindex 93f50a06bff..3530569c267 100644--- a/web/tests/compose.test.cjs+++ b/web/tests/compose.test.cjs@@ -283,10 +283,11 @@ test_ui("send_message", ({override, override_rewire, mock_template}) => {// This is the common setup stuff for all of the four tests.let stub_state;function initialize_state_stub_dict() {- stub_state = {};- stub_state.send_msg_called = 0;- stub_state.get_events_running_called = 0;- stub_state.reify_message_id_checked = 0;+ stub_state = {+ send_msg_called: 0,+ get_events_running_called: 0,+ reify_message_id_checked: 0,+ };return stub_state;}diff --git a/web/tests/compose_ui.test.cjs b/web/tests/compose_ui.test.cjsindex 87b1da63fca..1732c8cda5f 100644--- a/web/tests/compose_ui.test.cjs+++ b/web/tests/compose_ui.test.cjs@@ -51,12 +51,7 @@ people.add_active_user(bob);function make_textbox(s) {// Simulate a jQuery textbox for testing purposes.- const $widget = {};-- $widget.s = s;- $widget.length = 1;- $widget[0] = "textarea";- $widget.focused = false;+ const $widget = {s, length: 1, [0]: "textarea", focused: false};$widget.caret = function (arg) {if (typeof arg === "number") {diff --git a/web/tests/dispatch.test.cjs b/web/tests/dispatch.test.cjsindex a3c9369c80a..6d45bcf21d4 100644--- a/web/tests/dispatch.test.cjs+++ b/web/tests/dispatch.test.cjs@@ -668,12 +668,10 @@ run_test("realm settings", ({override}) => {// realmfunction test_realm_boolean(event, parameter_name) {override(realm, parameter_name, true);- event = {...event};- event.value = false;+ event = {...event, value: false};dispatch(event);assert.equal(realm[parameter_name], false);- event = {...event};- event.value = true;+ event = {...event, value: true};dispatch(event);assert.equal(realm[parameter_name], true);}diff --git a/web/tests/echo.test.cjs b/web/tests/echo.test.cjsindex a241558c35e..941c4e1a137 100644--- a/web/tests/echo.test.cjs+++ b/web/tests/echo.test.cjs@@ -208,19 +208,20 @@ run_test("process_from_server for messages to add to narrow", ({override}) => {run_test("build_display_recipient", ({override}) => {override(current_user, "user_id", 123);- const params = {};- params.realm_users = [- {- user_id: 123,- full_name: "Iago",- email: "[email protected]",- },- {- email: "[email protected]",- full_name: "Cordelia",- user_id: 21,- },- ];+ const params = {+ realm_users: [+ {+ user_id: 123,+ full_name: "Iago",+ email: "[email protected]",+ },+ {+ email: "[email protected]",+ full_name: "Cordelia",+ user_id: 21,+ },+ ],+ };const user_group_params = {realm_user_groups: [make_user_group({@@ -351,19 +352,20 @@ run_test("insert_local_message direct message", ({override}) => {override(current_user, "user_id", 123);- const params = {};- params.realm_users = [- {- user_id: 123,- full_name: "Iago",- email: "[email protected]",- },- {- email: "[email protected]",- full_name: "Cordelia",- user_id: 21,- },- ];+ const params = {+ realm_users: [+ {+ user_id: 123,+ full_name: "Iago",+ email: "[email protected]",+ },+ {+ email: "[email protected]",+ full_name: "Cordelia",+ user_id: 21,+ },+ ],+ };const user_group_params = {realm_user_groups: [make_user_group({diff --git a/web/tests/lib/stub.cjs b/web/tests/lib/stub.cjsindex 35241efca0e..a759392607f 100644--- a/web/tests/lib/stub.cjs+++ b/web/tests/lib/stub.cjs@@ -8,8 +8,7 @@ const assert = require("node:assert/strict");// like set_global() to override your namespace.exports.make_stub = function () {- const self = {};- self.num_calls = 0;+ const self = {num_calls: 0};self.f = function (...args) {self.last_call_args = args;diff --git a/web/tests/list_widget.test.cjs b/web/tests/list_widget.test.cjsindex 48a675170dd..f4cc2ff8fb4 100644--- a/web/tests/list_widget.test.cjs+++ b/web/tests/list_widget.test.cjs@@ -44,10 +44,7 @@ const ListWidget = zrequire("list_widget");// in the real code.function make_container() {- const $container = {};- $container.attr = noop;- $container.empty = noop;- $container.data = noop;+ const $container = {attr: noop, empty: noop, data: noop};// Make our append function just set a field we can// check in our tests.@@ -59,10 +56,7 @@ function make_container() {}function make_scroll_container() {- const $scroll_container = {};- $scroll_container[0] = {};-- $scroll_container.cleared = false;+ const $scroll_container = {[0]: {}, cleared: false};// Capture the scroll callback so we can call it in// our tests.@@ -83,9 +77,7 @@ function make_scroll_container() {}function make_sort_container() {- const $sort_container = {};-- $sort_container.cleared = false;+ const $sort_container = {cleared: false};$sort_container.on = (ev, sel, f) => {assert.equal(ev, "click.list_widget_sort");@@ -102,10 +94,7 @@ function make_sort_container() {}function make_filter_element() {- const $element = {};-- $element.cleared = false;- $element.clear_button_elem_cleared = false;+ const $element = {cleared: false, clear_button_elem_cleared: false};$element.on = (ev, f) => {assert.equal(ev, "input.list_widget_filter");@@ -155,13 +144,13 @@ function make_search_input() {};};- const clear_search_button_element = {};-- clear_search_button_element.on = (event, f) => {- assert.equal(event, "click");- $element.simulate_clear_search = () => {- f.call();- };+ const clear_search_button_element = {+ on(event, f) {+ assert.equal(event, "click");+ $element.simulate_clear_search = () => {+ f.call();+ };+ },};$element.siblings = (selector) => {@@ -763,12 +752,7 @@ run_test("replace_list_data w/filter update", () => {});run_test("opts.get_item", () => {- const items = {};-- items[1] = "one";- items[2] = "two";- items[3] = "three";- items[4] = "four";+ const items = {[1]: "one", [2]: "two", [3]: "three", [4]: "four"};const list = [1, 2, 3, 4];diff --git a/web/tests/markdown_parse.test.cjs b/web/tests/markdown_parse.test.cjsindex 786b7017831..7973a826298 100644--- a/web/tests/markdown_parse.test.cjs+++ b/web/tests/markdown_parse.test.cjs@@ -12,9 +12,10 @@ const linkifiers = zrequire("linkifiers");const my_id = 101;-const user_map = new Map();-user_map.set(my_id, "Me Myself");-user_map.set(105, "greg");+const user_map = new Map([+ [my_id, "Me Myself"],+ [105, "greg"],+]);function get_actual_name_from_user_id(user_id) {return user_map.get(user_id);@@ -48,8 +49,7 @@ const staff_group = {name: "Staff",};-const user_group_map = new Map();-user_group_map.set(staff_group.name, staff_group);+const user_group_map = new Map([[staff_group.name, staff_group]]);function get_user_group_from_name(name) {return user_group_map.get(name);@@ -66,8 +66,7 @@ const social = {name: "social",};-const sub_map = new Map();-sub_map.set(social.name, social);+const sub_map = new Map([[social.name, social]]);function get_stream_by_name(name) {return sub_map.get(name);@@ -88,9 +87,10 @@ function get_emoticon_translations() {];}-const emoji_map = new Map();-emoji_map.set("smile", "1f604");-emoji_map.set("alien", "1f47d");+const emoji_map = new Map([+ ["smile", "1f604"],+ ["alien", "1f47d"],+]);function get_emoji_codepoint(emoji_name) {return emoji_map.get(emoji_name);@@ -107,19 +107,22 @@ function get_emoji_name(codepoint) {throw new Error(`unexpected codepoint ${codepoint}`);}-const realm_emoji_map = new Map();-realm_emoji_map.set("heart", "/images/emoji/heart.bmp");+const realm_emoji_map = new Map([["heart", "/images/emoji/heart.bmp"]]);function get_realm_emoji_url(emoji_name) {return realm_emoji_map.get(emoji_name);}const regex = /#foo(\d+)(?!\w)/g;-const linkifier_map = new Map();-linkifier_map.set(regex, {- url_template: url_template_lib.parseTemplate("http://foo.com/{id}"),- group_number_to_name: {1: "id"},-});+const linkifier_map = new Map([+ [+ regex,+ {+ url_template: url_template_lib.parseTemplate("http://foo.com/{id}"),+ group_number_to_name: {1: "id"},+ },+ ],+]);function get_linkifier_map() {return linkifier_map;diff --git a/web/tests/message_events.test.cjs b/web/tests/message_events.test.cjsindex 6beedb5b3fc..7cd1edd4c15 100644--- a/web/tests/message_events.test.cjs+++ b/web/tests/message_events.test.cjs@@ -60,13 +60,11 @@ function test_helper(side_effects) {};}- const self = {};-- self.verify = () => {- assert.deepEqual(side_effects, events);+ return {+ verify() {+ assert.deepEqual(side_effects, events);+ },};-- return self;}run_test("update_messages", ({override, override_rewire}) => {diff --git a/web/tests/message_list_view.test.cjs b/web/tests/message_list_view.test.cjsindex 7529f4db882..acc30e127f2 100644--- a/web/tests/message_list_view.test.cjs+++ b/web/tests/message_list_view.test.cjs@@ -132,17 +132,16 @@ test("message_edited_vars", () => {// * message without senderfunction build_message_context(message = {}, message_context = {}) {- message_context = {+ return {include_sender: true,...message_context,+ msg: {+ is_me_message: false,+ last_edit_timestamp: (next_timestamp += 1),+ edit_history: [{prev_content: "test_content", timestamp: 1000, user_id: 1}],+ ...message,+ },};- message_context.msg = {- is_me_message: false,- last_edit_timestamp: (next_timestamp += 1),- edit_history: [{prev_content: "test_content", timestamp: 1000, user_id: 1}],- ...message,- };- return message_context;}function build_message_group(messages) {@@ -227,13 +226,7 @@ test("muted_message_vars", () => {// correctly.function build_message_context(message = {}, message_context = {}) {- message_context = {- ...message_context,- };- message_context.msg = {- ...message,- };- return message_context;+ return {...message_context, msg: {...message}};}function build_message_group(messages) {@@ -372,21 +365,20 @@ test("merge_message_groups", ({mock_template}) => {// group merging logic on its own.function build_message_context(message = {}, message_context = {}) {- message_context = {+ return {include_sender: true,...message_context,+ msg: {+ id: _.uniqueId("test_message_"),+ status_message: false,+ type: "stream",+ stream_id: 2,+ topic: "Test topic 1",+ sender_email: "[email protected]",+ timestamp: (next_timestamp += 1),+ ...message,+ },};- message_context.msg = {- id: _.uniqueId("test_message_"),- status_message: false,- type: "stream",- stream_id: 2,- topic: "Test topic 1",- sender_email: "[email protected]",- timestamp: (next_timestamp += 1),- ...message,- };- return message_context;}function build_message_group(messages) {diff --git a/web/tests/message_store.test.cjs b/web/tests/message_store.test.cjsindex 18aa51409b3..9841a385d33 100644--- a/web/tests/message_store.test.cjs+++ b/web/tests/message_store.test.cjs@@ -289,14 +289,14 @@ test("reify_message_id", () => {});test("update_booleans", () => {- const message = {};-// First, test fields that we do actually want to update.- message.mentioned = false;- message.mentioned_me_directly = false;- message.stream_wildcard_mentioned = false;- message.topic_wildcard_mentioned = false;- message.alerted = false;+ const message = {+ mentioned: false,+ mentioned_me_directly: false,+ stream_wildcard_mentioned: false,+ topic_wildcard_mentioned: false,+ alerted: false,+ };let flags = ["mentioned", "has_alert_word", "read"];message_store.update_booleans(message, flags);diff --git a/web/tests/password.test.cjs b/web/tests/password.test.cjsindex 36786d0f242..a58e5ba98ed 100644--- a/web/tests/password.test.cjs+++ b/web/tests/password.test.cjs@@ -8,23 +8,21 @@ const {run_test} = require("./lib/test.cjs");const {password_quality, password_warning} = zrequire("password_quality");function password_field(min_length, max_length, min_guesses) {- const self = {};-- self.attr = (name) => {- switch (name) {- case "data-min-length":- return min_length;- case "data-min-guesses":- return min_guesses;- case "data-max-length":- return max_length;- /* istanbul ignore next */- default:- throw new Error(`Unknown attribute ${name}`);- }+ return {+ attr(name) {+ switch (name) {+ case "data-min-length":+ return min_length;+ case "data-min-guesses":+ return min_guesses;+ case "data-max-length":+ return max_length;+ /* istanbul ignore next */+ default:+ throw new Error(`Unknown attribute ${name}`);+ }+ },};-- return self;}run_test("basics w/progress bar", () => {diff --git a/web/tests/people.test.cjs b/web/tests/people.test.cjsindex 75b39b7fea0..4c011563e67 100644--- a/web/tests/people.test.cjs+++ b/web/tests/people.test.cjs@@ -1680,22 +1680,23 @@ test_people("fetch_users", async ({override}) => {},];- const params = {};- params.realm_users = [- {- email: "[email protected]",- user_id: 42,- full_name: "Me Myself",- },- ];- params.realm_non_active_users = [];- params.cross_realm_bots = [- {- email: "[email protected]",- user_id: 17,- full_name: "Test Bot",- },- ];+ const params = {+ realm_users: [+ {+ email: "[email protected]",+ user_id: 42,+ full_name: "Me Myself",+ },+ ],+ realm_non_active_users: [],+ cross_realm_bots: [+ {+ email: "[email protected]",+ user_id: 17,+ full_name: "Test Bot",+ },+ ],+ };const user_group_params = {realm_user_groups: [make_user_group({diff --git a/web/tests/presence.test.cjs b/web/tests/presence.test.cjsindex 867f7f17c7b..e9df6796006 100644--- a/web/tests/presence.test.cjs+++ b/web/tests/presence.test.cjs@@ -156,51 +156,25 @@ test("status_from_raw", () => {});test("set_presence_info", () => {- const presences = {};const now = 5000;const recent = now + 1 - OFFLINE_THRESHOLD_SECS;const a_while_ago = now - OFFLINE_THRESHOLD_SECS * 2;const unknown_user_id = 999;- presences[alice.user_id.toString()] = {- active_timestamp: recent,+ const presences = {+ [alice.user_id.toString()]: {active_timestamp: recent},+ [fred.user_id.toString()]: {active_timestamp: a_while_ago, idle_timestamp: now},+ [me.user_id.toString()]: {active_timestamp: now},+ [sally.user_id.toString()]: {active_timestamp: a_while_ago},+ [john.user_id.toString()]: {idle_timestamp: a_while_ago},+ [jane.user_id.toString()]: {idle_timestamp: now},+ // Unknown user ids can also be in the presence data.+ [unknown_user_id.toString()]: {idle_timestamp: now},+ [inaccessible_user_id.toString()]: {idle_timestamp: now},};- presences[fred.user_id.toString()] = {- active_timestamp: a_while_ago,- idle_timestamp: now,- };-- presences[me.user_id.toString()] = {- active_timestamp: now,- };-- presences[sally.user_id.toString()] = {- active_timestamp: a_while_ago,- };-- presences[john.user_id.toString()] = {- idle_timestamp: a_while_ago,- };-- presences[jane.user_id.toString()] = {- idle_timestamp: now,- };-- // Unknown user ids can also be in the presence data.- presences[unknown_user_id.toString()] = {- idle_timestamp: now,- };-- presences[inaccessible_user_id.toString()] = {- idle_timestamp: now,- };-- const params = {};- params.presences = presences;- params.server_timestamp = now;- presence.initialize(params);+ presence.initialize({presences, server_timestamp: now});assert.deepEqual(presence.presence_info.get(alice.user_id), {status: "active",@@ -259,11 +233,7 @@ test("missing values", () => {*/const now = 2000000;const a_bit_ago = now - 5;- const presences = {};-- presences[zoe.user_id.toString()] = {- idle_timestamp: a_bit_ago,- };+ const presences = {[zoe.user_id.toString()]: {idle_timestamp: a_bit_ago}};presence.set_info(presences, now);@@ -285,12 +255,8 @@ test("missing values", () => {});test("big realms", ({override_rewire}) => {- const presences = {};const now = 5000;-- presences[sally.user_id.toString()] = {- active_timestamp: now,- };+ const presences = {[sally.user_id.toString()]: {active_timestamp: now}};// Make it seem like realm has a lot of people, in// which case we will not provide default values fordiff --git a/web/tests/settings_org.test.cjs b/web/tests/settings_org.test.cjsindex 73af9f76bd6..702b67afe34 100644--- a/web/tests/settings_org.test.cjs+++ b/web/tests/settings_org.test.cjs@@ -88,8 +88,7 @@ function createSaveButtons(subsection) {$stub_discard_button,);$save_button_controls.set_find_results(".discard-button", $stub_discard_button);- const props = {};- props.hidden = false;+ const props = {hidden: false};$save_button_controls.fadeIn = () => {props.hidden = false;};diff --git a/web/tests/stream_data.test.cjs b/web/tests/stream_data.test.cjsindex b4516aee652..00261a3c286 100644--- a/web/tests/stream_data.test.cjs+++ b/web/tests/stream_data.test.cjs@@ -1307,35 +1307,33 @@ test("creator_id", ({override}) => {test("initialize", ({override}) => {function get_params() {- const params = {};-- params.subscriptions = [- {- name: "subscriptions",- stream_id: 2001,- subscriber_count: 0,- },- ];-- params.unsubscribed = [- {- name: "unsubscribed",- stream_id: 2002,- subscriber_count: 0,- },- ];+ return {+ subscriptions: [+ {+ name: "subscriptions",+ stream_id: 2001,+ subscriber_count: 0,+ },+ ],- params.never_subscribed = [- {- name: "never_subscribed",- stream_id: 2003,- subscriber_count: 0,- },- ];+ unsubscribed: [+ {+ name: "unsubscribed",+ stream_id: 2002,+ subscriber_count: 0,+ },+ ],- params.realm_default_streams = [];+ never_subscribed: [+ {+ name: "never_subscribed",+ stream_id: 2003,+ subscriber_count: 0,+ },+ ],- return params;+ realm_default_streams: [],+ };}function initialize() {@@ -2184,7 +2182,7 @@ test("can_preview", ({override_rewire}) => {run_test("can_toggle_subscription", ({override}) => {const social = {- subscribed: false,+ subscribed: true,color: "red",name: "social",stream_id: 2,@@ -2195,7 +2193,6 @@ run_test("can_toggle_subscription", ({override}) => {can_administer_channel_group: nobody_group.id,can_subscribe_group: nobody_group.id,};- social.subscribed = true;override(current_user, "user_id", me.user_id);diff --git a/web/tests/support.test.cjs b/web/tests/support.test.cjsindex bf6310091bd..cb001d068e0 100644--- a/web/tests/support.test.cjs+++ b/web/tests/support.test.cjs@@ -31,10 +31,12 @@ run_test("scrub_realm", () => {};let submit_form_called = false;- const fake_this = {to_$: () => $fake_this};- fake_this.form = {- submit() {- submit_form_called = true;+ const fake_this = {+ to_$: () => $fake_this,+ form: {+ submit() {+ submit_form_called = true;+ },},};const event = {diff --git a/web/tests/user_groups.test.cjs b/web/tests/user_groups.test.cjsindex 48a903151a3..cb498d3576d 100644--- a/web/tests/user_groups.test.cjs+++ b/web/tests/user_groups.test.cjs@@ -49,13 +49,14 @@ run_test("user_groups", () => {deactivated: false,});- const params = {};- params.realm_user_groups = [- students,- get_test_subgroup(4),- get_test_subgroup(5),- get_test_subgroup(6),- ];+ const params = {+ realm_user_groups: [+ students,+ get_test_subgroup(4),+ get_test_subgroup(5),+ get_test_subgroup(6),+ ],+ };const user_id_not_in_any_group = 0;const user_id_part_of_a_group = 2;const user_id_associated_via_subgroup = 4;diff --git a/web/tests/user_search.test.cjs b/web/tests/user_search.test.cjsindex ffc905af4b3..204c5df0438 100644--- a/web/tests/user_search.test.cjs+++ b/web/tests/user_search.test.cjs@@ -224,11 +224,12 @@ test("blur search left", ({override}) => {});test("filter_user_ids", ({override}) => {- const user_presence = {};- user_presence[alice.user_id] = "active";- user_presence[fred.user_id] = "active";- user_presence[jill.user_id] = "active";- user_presence[me.user_id] = "active";+ const user_presence = {+ [alice.user_id]: "active",+ [fred.user_id]: "active",+ [jill.user_id]: "active",+ [me.user_id]: "active",+ };override(presence, "get_status", (user_id) => user_presence[user_id]);override(presence, "get_user_ids", () => all_user_ids);