From 7e3735b9baca11fa22e8d796affe34d5c3ed4b84 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 22 Feb 2021 18:54:07 -0800 Subject: [PATCH] =?UTF-8?q?node=5Ftests:=20Don=E2=80=99t=20read=20page=5Fp?= =?UTF-8?q?arams=20from=20deprecated=20global=20variable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow up to commit 89aa3155a97f9cd7977766a530787e2a14219091 (#17262). Signed-off-by: Anders Kaseorg --- .eslintrc.json | 6 ++---- frontend_tests/node_tests/activity.js | 7 +++---- frontend_tests/node_tests/billing_helpers.js | 2 +- frontend_tests/node_tests/buddy_data.js | 3 +-- frontend_tests/node_tests/compose.js | 2 +- frontend_tests/node_tests/composebox_typeahead.js | 2 +- frontend_tests/node_tests/dispatch.js | 2 +- frontend_tests/node_tests/echo.js | 2 +- frontend_tests/node_tests/filter.js | 2 +- frontend_tests/node_tests/hotkey.js | 2 +- frontend_tests/node_tests/markdown.js | 2 +- frontend_tests/node_tests/message_edit.js | 12 ++++++------ frontend_tests/node_tests/message_events.js | 2 +- frontend_tests/node_tests/message_list_view.js | 2 +- frontend_tests/node_tests/muting.js | 2 +- frontend_tests/node_tests/notifications.js | 2 +- frontend_tests/node_tests/people.js | 2 +- frontend_tests/node_tests/rendered_markdown.js | 8 ++++---- frontend_tests/node_tests/search_suggestion.js | 2 +- .../node_tests/search_suggestion_legacy.js | 2 +- frontend_tests/node_tests/settings_bots.js | 2 +- frontend_tests/node_tests/settings_data.js | 2 +- frontend_tests/node_tests/settings_org.js | 5 ++--- frontend_tests/node_tests/settings_profile_fields.js | 2 +- frontend_tests/node_tests/settings_user_groups.js | 2 +- frontend_tests/node_tests/stream_data.js | 2 +- frontend_tests/node_tests/stream_edit.js | 2 +- frontend_tests/node_tests/stream_list.js | 2 +- frontend_tests/node_tests/timerender.js | 6 +++--- frontend_tests/node_tests/transmit.js | 2 +- frontend_tests/node_tests/typeahead_helper.js | 2 +- frontend_tests/node_tests/ui_init.js | 2 +- frontend_tests/node_tests/unread.js | 8 ++++---- frontend_tests/node_tests/upload.js | 2 +- frontend_tests/node_tests/user_events.js | 2 +- frontend_tests/node_tests/user_pill.js | 2 +- 36 files changed, 53 insertions(+), 58 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index ee141bf507..233bcb1532 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -112,16 +112,14 @@ "current_msg_list": false, "home_msg_list": false, "i18n": false, - "location": false, - "page_params": false + "location": false } }, { "files": ["frontend_tests/puppeteer_lib/**", "frontend_tests/puppeteer_tests/**"], "globals": { "$": false, - "current_msg_list": false, - "page_params": false + "current_msg_list": false } }, { diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.js index 3d8efa1e48..6094183f2b 100644 --- a/frontend_tests/node_tests/activity.js +++ b/frontend_tests/node_tests/activity.js @@ -14,10 +14,10 @@ let filter_key_handlers; const huddle_data = zrequire("huddle_data"); -const _page_params = { +let page_params = set_global("page_params", { realm_users: [], user_id: 999, -}; +}); const _document = { hasFocus() { @@ -69,7 +69,6 @@ set_global("channel", channel); set_global("compose_state", compose_state); set_global("document", _document); set_global("keydown_util", _keydown_util); -set_global("page_params", _page_params); set_global("pm_list", _pm_list); set_global("popovers", _popovers); set_global("resize", _resize); @@ -749,7 +748,7 @@ test_ui("electron_bridge", () => { }); test_ui("test_send_or_receive_no_presence_for_web_public_visitor", () => { - set_global("page_params", { + page_params = set_global("page_params", { is_web_public_visitor: true, }); activity.send_presence_to_server(); diff --git a/frontend_tests/node_tests/billing_helpers.js b/frontend_tests/node_tests/billing_helpers.js index a750ad960e..15d65204b4 100644 --- a/frontend_tests/node_tests/billing_helpers.js +++ b/frontend_tests/node_tests/billing_helpers.js @@ -14,7 +14,7 @@ const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8"); const dom = new JSDOM(template, {pretendToBeVisual: true}); const jquery = jQueryFactory(dom.window); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const loading = set_global("loading", {}); const history = set_global("history", {}); set_global("document", { diff --git a/frontend_tests/node_tests/buddy_data.js b/frontend_tests/node_tests/buddy_data.js index 7678dd6afe..c0e142b89b 100644 --- a/frontend_tests/node_tests/buddy_data.js +++ b/frontend_tests/node_tests/buddy_data.js @@ -7,9 +7,8 @@ const _ = require("lodash"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const _page_params = {}; +const page_params = set_global("page_params", {}); -set_global("page_params", _page_params); const people = zrequire("people"); const presence = zrequire("presence"); const user_status = zrequire("user_status"); diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js index df6d86a5fb..3275b15e2f 100644 --- a/frontend_tests/node_tests/compose.js +++ b/frontend_tests/node_tests/compose.js @@ -61,7 +61,7 @@ const channel = set_global("channel", {}); const stream_edit = set_global("stream_edit", {}); const markdown = set_global("markdown", {}); const loading = set_global("loading", {}); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const resize = set_global("resize", {}); const subs = set_global("subs", {}); const ui_util = set_global("ui_util", {}); diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.js index 1a6db212dc..90dc56b9fc 100644 --- a/frontend_tests/node_tests/composebox_typeahead.js +++ b/frontend_tests/node_tests/composebox_typeahead.js @@ -171,7 +171,7 @@ stream_data.add_sub(sweden_stream); stream_data.add_sub(denmark_stream); stream_data.add_sub(netherland_stream); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const channel = set_global("channel", {}); const compose = set_global("compose", { finish: noop, diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js index 64a4b26fa9..ec675199d0 100644 --- a/frontend_tests/node_tests/dispatch.js +++ b/frontend_tests/node_tests/dispatch.js @@ -63,7 +63,7 @@ const user_events = set_global("user_events", {}); const user_groups = set_global("user_groups", {}); // page_params is highly coupled to dispatching now -set_global("page_params", { +const page_params = set_global("page_params", { test_suite: false, is_admin: true, realm_description: "already set description", diff --git a/frontend_tests/node_tests/echo.js b/frontend_tests/node_tests/echo.js index afd1d1cfd8..04fa970a29 100644 --- a/frontend_tests/node_tests/echo.js +++ b/frontend_tests/node_tests/echo.js @@ -9,7 +9,7 @@ const {run_test} = require("../zjsunit/test"); const local_message = set_global("local_message", {}); const markdown = set_global("markdown", {}); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const fake_now = 555; MockDate.set(new Date(fake_now * 1000)); diff --git a/frontend_tests/node_tests/filter.js b/frontend_tests/node_tests/filter.js index d011f9e70b..c585022e29 100644 --- a/frontend_tests/node_tests/filter.js +++ b/frontend_tests/node_tests/filter.js @@ -13,7 +13,7 @@ zrequire("message_util", "js/message_util"); const Filter = zrequire("Filter", "js/filter"); const message_store = set_global("message_store", {}); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const me = { email: "me@example.com", diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.js index 262a40e1ea..ed1ef2aaa2 100644 --- a/frontend_tests/node_tests/hotkey.js +++ b/frontend_tests/node_tests/hotkey.js @@ -25,7 +25,7 @@ set_global("navigator", { platform: "", }); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); let overlays = set_global("overlays", {}); diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.js index 79fd686d8d..3e365dd95b 100644 --- a/frontend_tests/node_tests/markdown.js +++ b/frontend_tests/node_tests/markdown.js @@ -38,7 +38,7 @@ const emoji_params = { emoji_codes, }; -set_global("page_params", { +const page_params = set_global("page_params", { realm_users: [], realm_filters: [ ["#(?P[0-9]{2,8})", "https://trac.example.com/ticket/%(id)s"], diff --git a/frontend_tests/node_tests/message_edit.js b/frontend_tests/node_tests/message_edit.js index 9c5c8a6e5e..dd577ffbe0 100644 --- a/frontend_tests/node_tests/message_edit.js +++ b/frontend_tests/node_tests/message_edit.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -set_global("page_params", { +let page_params = set_global("page_params", { realm_community_topic_editing_limit_seconds: 259200, }); @@ -51,19 +51,19 @@ run_test("get_editability", () => { sent_by_me: true, }; - set_global("page_params", { + page_params = set_global("page_params", { realm_allow_message_editing: false, }); assert.equal(get_editability(message), editability_types.NO); - set_global("page_params", { + page_params = set_global("page_params", { realm_allow_message_editing: true, // Limit of 0 means no time limit on editing messages realm_message_content_edit_limit_seconds: 0, }); assert.equal(get_editability(message), editability_types.FULL); - set_global("page_params", { + page_params = set_global("page_params", { realm_allow_message_editing: true, realm_message_content_edit_limit_seconds: 10, }); @@ -85,7 +85,7 @@ run_test("get_editability", () => { sent_by_me: false, type: "stream", }; - set_global("page_params", { + page_params = set_global("page_params", { realm_allow_community_topic_editing: true, realm_allow_message_editing: true, realm_message_content_edit_limit_seconds: 0, @@ -116,7 +116,7 @@ run_test("get_editability", () => { }); run_test("get_deletability", () => { - set_global("page_params", { + page_params = set_global("page_params", { is_admin: true, realm_allow_message_deleting: false, realm_message_content_delete_limit_seconds: 0, diff --git a/frontend_tests/node_tests/message_events.js b/frontend_tests/node_tests/message_events.js index 25de0d9d1e..64f8ba76f3 100644 --- a/frontend_tests/node_tests/message_events.js +++ b/frontend_tests/node_tests/message_events.js @@ -19,7 +19,7 @@ set_global("current_msg_list", {}); const message_edit = set_global("message_edit", {}); const message_list = set_global("message_list", {}); const notifications = set_global("notifications", {}); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const pm_list = set_global("pm_list", {}); const stream_list = set_global("stream_list", {}); const unread_ui = set_global("unread_ui", {}); diff --git a/frontend_tests/node_tests/message_list_view.js b/frontend_tests/node_tests/message_list_view.js index 8ea9c7a288..bac1e79f54 100644 --- a/frontend_tests/node_tests/message_list_view.js +++ b/frontend_tests/node_tests/message_list_view.js @@ -17,7 +17,7 @@ const message_list = zrequire("message_list"); const noop = function () {}; -set_global("page_params", { +const page_params = set_global("page_params", { twenty_four_hour_time: false, }); set_global("home_msg_list", "stub"); diff --git a/frontend_tests/node_tests/muting.js b/frontend_tests/node_tests/muting.js index 799faf1b1c..1a4cb7c468 100644 --- a/frontend_tests/node_tests/muting.js +++ b/frontend_tests/node_tests/muting.js @@ -8,7 +8,7 @@ const {run_test} = require("../zjsunit/test"); zrequire("timerender"); const muting = zrequire("muting"); const stream_data = zrequire("stream_data"); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); run_test("edge_cases", () => { // private messages diff --git a/frontend_tests/node_tests/notifications.js b/frontend_tests/node_tests/notifications.js index 702e599724..c494d1553d 100644 --- a/frontend_tests/node_tests/notifications.js +++ b/frontend_tests/node_tests/notifications.js @@ -14,7 +14,7 @@ set_global("document", { return true; }, }); -set_global("page_params", { +const page_params = set_global("page_params", { is_admin: false, realm_users: [], enable_desktop_notifications: true, diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.js index 16a7a524c3..e8fa494132 100644 --- a/frontend_tests/node_tests/people.js +++ b/frontend_tests/node_tests/people.js @@ -10,7 +10,7 @@ const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const message_store = set_global("message_store", {}); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const people = zrequire("people"); const settings_config = zrequire("settings_config"); diff --git a/frontend_tests/node_tests/rendered_markdown.js b/frontend_tests/node_tests/rendered_markdown.js index 6905666795..8d46762c86 100644 --- a/frontend_tests/node_tests/rendered_markdown.js +++ b/frontend_tests/node_tests/rendered_markdown.js @@ -65,7 +65,7 @@ const $array = (array) => { return {each}; }; -set_global("page_params", {emojiset: "apple"}); +let page_params = set_global("page_params", {emojiset: "apple"}); const get_content_element = () => { $.clear_all_elements(); @@ -197,16 +197,16 @@ run_test("timestamp-twenty-four-hour-time", () => { // We will temporarily change the 24h setting for this test. const old_page_params = page_params; - set_global("page_params", {...old_page_params, twenty_four_hour_time: true}); + page_params = set_global("page_params", {...old_page_params, twenty_four_hour_time: true}); rm.update_elements($content); assert.equal($timestamp.text(), "Wed, Jul 15 2020, 20:40"); - set_global("page_params", {...old_page_params, twenty_four_hour_time: false}); + page_params = set_global("page_params", {...old_page_params, twenty_four_hour_time: false}); rm.update_elements($content); assert.equal($timestamp.text(), "Wed, Jul 15 2020, 8:40 PM"); // Set page_params back to its original value. - set_global("page_params", old_page_params); + page_params = set_global("page_params", old_page_params); }); run_test("timestamp-error", () => { diff --git a/frontend_tests/node_tests/search_suggestion.js b/frontend_tests/node_tests/search_suggestion.js index d07a4236e4..714f25ee35 100644 --- a/frontend_tests/node_tests/search_suggestion.js +++ b/frontend_tests/node_tests/search_suggestion.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -set_global("page_params", { +const page_params = set_global("page_params", { search_pills_enabled: true, }); diff --git a/frontend_tests/node_tests/search_suggestion_legacy.js b/frontend_tests/node_tests/search_suggestion_legacy.js index 41766debf7..f5ef3ab490 100644 --- a/frontend_tests/node_tests/search_suggestion_legacy.js +++ b/frontend_tests/node_tests/search_suggestion_legacy.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -set_global("page_params", { +const page_params = set_global("page_params", { search_pills_enabled: false, }); set_global("message_store", { diff --git a/frontend_tests/node_tests/settings_bots.js b/frontend_tests/node_tests/settings_bots.js index d445048cdf..609590d7e8 100644 --- a/frontend_tests/node_tests/settings_bots.js +++ b/frontend_tests/node_tests/settings_bots.js @@ -8,7 +8,7 @@ const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -set_global("page_params", { +const page_params = set_global("page_params", { realm_uri: "https://chat.example.com", realm_embedded_bots: [ {name: "converter", config: {}}, diff --git a/frontend_tests/node_tests/settings_data.js b/frontend_tests/node_tests/settings_data.js index b360d65a33..c009f29a77 100644 --- a/frontend_tests/node_tests/settings_data.js +++ b/frontend_tests/node_tests/settings_data.js @@ -8,7 +8,7 @@ const {run_test} = require("../zjsunit/test"); const settings_data = zrequire("settings_data"); const settings_config = zrequire("settings_config"); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); /* Some methods in settings_data are fairly diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index ec0d120fd9..93938bc078 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -30,14 +30,14 @@ const _loading = { destroy_indicator: noop, }; -const _page_params = { +const page_params = set_global("page_params", { is_admin: false, realm_domains: [ {domain: "example.com", allow_subdomains: true}, {domain: "example.org", allow_subdomains: false}, ], realm_authentication_methods: {}, -}; +}); const realm_icon = set_global("realm_icon", {}); const channel = set_global("channel", {}); @@ -74,7 +74,6 @@ set_global("csrf_token", "token-stub"); set_global("FormData", _FormData); set_global("jQuery", _jQuery); set_global("loading", _loading); -set_global("page_params", _page_params); set_global("realm_logo", _realm_logo); set_global("ui_report", _ui_report); set_global("ListWidget", _ListWidget); diff --git a/frontend_tests/node_tests/settings_profile_fields.js b/frontend_tests/node_tests/settings_profile_fields.js index e56850edde..aebeb76760 100644 --- a/frontend_tests/node_tests/settings_profile_fields.js +++ b/frontend_tests/node_tests/settings_profile_fields.js @@ -9,7 +9,7 @@ const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const loading = set_global("loading", {}); const SHORT_TEXT_ID = 1; diff --git a/frontend_tests/node_tests/settings_user_groups.js b/frontend_tests/node_tests/settings_user_groups.js index fb92ac2bd0..1f340b495c 100644 --- a/frontend_tests/node_tests/settings_user_groups.js +++ b/frontend_tests/node_tests/settings_user_groups.js @@ -34,7 +34,7 @@ const ui_report = set_global("ui_report", {}); const people = zrequire("people"); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); function reset_test_setup(pill_container_stub) { function input_pill_stub(opts) { diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js index c1de522183..02e993493d 100644 --- a/frontend_tests/node_tests/stream_data.js +++ b/frontend_tests/node_tests/stream_data.js @@ -7,7 +7,7 @@ const _ = require("lodash"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -set_global("page_params", { +const page_params = set_global("page_params", { is_admin: false, realm_users: [], is_guest: false, diff --git a/frontend_tests/node_tests/stream_edit.js b/frontend_tests/node_tests/stream_edit.js index ce2ece29ec..1a64f28d39 100644 --- a/frontend_tests/node_tests/stream_edit.js +++ b/frontend_tests/node_tests/stream_edit.js @@ -19,7 +19,7 @@ set_global("hash_util", { set_global("ListWidget", { create: () => ({init: noop}), }); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); set_global("settings_notifications", { get_notifications_table_row_data: noop, }); diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.js index c106aff366..9e95a3f2c3 100644 --- a/frontend_tests/node_tests/stream_list.js +++ b/frontend_tests/node_tests/stream_list.js @@ -20,7 +20,7 @@ const scroll_util = zrequire("scroll_util"); zrequire("list_cursor"); const stream_list = zrequire("stream_list"); zrequire("ui"); -set_global("page_params", { +const page_params = set_global("page_params", { is_admin: false, realm_users: [], }); diff --git a/frontend_tests/node_tests/timerender.js b/frontend_tests/node_tests/timerender.js index 16aa405981..6321c3faf9 100644 --- a/frontend_tests/node_tests/timerender.js +++ b/frontend_tests/node_tests/timerender.js @@ -9,7 +9,7 @@ const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -set_global("page_params", { +let page_params = set_global("page_params", { twenty_four_hour_time: true, }); @@ -158,7 +158,7 @@ run_test("get_timestamp_for_flatpickr", () => { }); run_test("absolute_time_12_hour", () => { - set_global("page_params", { + page_params = set_global("page_params", { twenty_four_hour_time: false, }); @@ -190,7 +190,7 @@ run_test("absolute_time_12_hour", () => { }); run_test("absolute_time_24_hour", () => { - set_global("page_params", { + page_params = set_global("page_params", { twenty_four_hour_time: true, }); diff --git a/frontend_tests/node_tests/transmit.js b/frontend_tests/node_tests/transmit.js index a3bbf03a9f..dc32882217 100644 --- a/frontend_tests/node_tests/transmit.js +++ b/frontend_tests/node_tests/transmit.js @@ -7,7 +7,7 @@ const {run_test} = require("../zjsunit/test"); const noop = function () {}; -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const channel = set_global("channel", {}); const reload = set_global("reload", {}); const reload_state = set_global("reload_state", {}); diff --git a/frontend_tests/node_tests/typeahead_helper.js b/frontend_tests/node_tests/typeahead_helper.js index f3e899ac9e..5bcbbfddaa 100644 --- a/frontend_tests/node_tests/typeahead_helper.js +++ b/frontend_tests/node_tests/typeahead_helper.js @@ -6,7 +6,7 @@ const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -set_global("page_params", {realm_is_zephyr_mirror_realm: false}); +const page_params = set_global("page_params", {realm_is_zephyr_mirror_realm: false}); const settings_config = zrequire("settings_config"); const pm_conversations = zrequire("pm_conversations"); diff --git a/frontend_tests/node_tests/ui_init.js b/frontend_tests/node_tests/ui_init.js index 05eb4dd1e8..be2c5c9c0f 100644 --- a/frontend_tests/node_tests/ui_init.js +++ b/frontend_tests/node_tests/ui_init.js @@ -40,7 +40,7 @@ set_global("csrf_token", "whatever"); set_global("$", () => {}); const resize = set_global("resize", {}); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const ignore_modules = [ "activity", diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js index 5ec0ef09b9..451398ffb6 100644 --- a/frontend_tests/node_tests/unread.js +++ b/frontend_tests/node_tests/unread.js @@ -12,7 +12,7 @@ const people = zrequire("people"); const stream_data = zrequire("stream_data"); const unread = zrequire("unread"); -set_global("page_params", { +let page_params = set_global("page_params", { realm_push_notifications_enabled: false, }); zrequire("settings_notifications"); @@ -49,17 +49,17 @@ function assert_zero_counts(counts) { } function test_notifiable_count(home_unread_messages, expected_notifiable_count) { - set_global("page_params", { + page_params = set_global("page_params", { desktop_icon_count_display: 1, }); let notifiable_counts = unread.get_notifiable_count(); assert.deepEqual(notifiable_counts, home_unread_messages); - set_global("page_params", { + page_params = set_global("page_params", { desktop_icon_count_display: 2, }); notifiable_counts = unread.get_notifiable_count(); assert.deepEqual(notifiable_counts, expected_notifiable_count); - set_global("page_params", { + page_params = set_global("page_params", { desktop_icon_count_display: 3, }); notifiable_counts = unread.get_notifiable_count(); diff --git a/frontend_tests/node_tests/upload.js b/frontend_tests/node_tests/upload.js index a74bd790ce..c35727175e 100644 --- a/frontend_tests/node_tests/upload.js +++ b/frontend_tests/node_tests/upload.js @@ -14,7 +14,7 @@ set_global("document", { set_global("navigator", { userAgent: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)", }); -set_global("page_params", { +const page_params = set_global("page_params", { max_file_upload_size: 25, }); set_global("csrf_token", "csrf_token"); diff --git a/frontend_tests/node_tests/user_events.js b/frontend_tests/node_tests/user_events.js index 5b0b35f2e6..7e7e7c3978 100644 --- a/frontend_tests/node_tests/user_events.js +++ b/frontend_tests/node_tests/user_events.js @@ -32,7 +32,7 @@ set_global("settings_users", { set_global("gear_menu", { update_org_settings_menu_item() {}, }); -set_global("page_params", { +const page_params = set_global("page_params", { is_admin: true, }); diff --git a/frontend_tests/node_tests/user_pill.js b/frontend_tests/node_tests/user_pill.js index bd45e83c54..a4c9c60d5f 100644 --- a/frontend_tests/node_tests/user_pill.js +++ b/frontend_tests/node_tests/user_pill.js @@ -8,7 +8,7 @@ const {run_test} = require("../zjsunit/test"); const people = zrequire("people"); const user_pill = zrequire("user_pill"); -set_global("page_params", {}); +const page_params = set_global("page_params", {}); const alice = { email: "alice@example.com",