node_tests: Don’t read from most deprecated global variables.

We still need to write to these globals with set_global because the
code being tested reads from them, but the tests themselves should
never need to read from them.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-02-09 19:53:22 -08:00
parent 34e37cea1c
commit 89aa3155a9
110 changed files with 407 additions and 399 deletions

View File

@@ -9,9 +9,9 @@ const {make_zjquery} = require("../zjsunit/zjquery");
set_global("$", make_zjquery());
zrequire("localstorage");
zrequire("drafts");
zrequire("timerender");
const localstorage = zrequire("localstorage");
const drafts = zrequire("drafts");
const timerender = zrequire("timerender");
zrequire("stream_color");
zrequire("colorspace");
@@ -20,7 +20,7 @@ const noop = function () {
return;
};
set_global("localStorage", {
const localStorage = set_global("localStorage", {
getItem(key) {
return ls_container.get(key);
},
@@ -35,7 +35,7 @@ set_global("localStorage", {
},
});
set_global("compose", {});
set_global("compose_state", {});
const compose_state = set_global("compose_state", {});
set_global("stream_data", {
get_color() {
return "#FFFFFF";