zjsunit: Deglobalize assert.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-11-30 14:46:45 -08:00 committed by Steve Howell
parent a9ad69bfa4
commit 7b03d48798
124 changed files with 240 additions and 5 deletions

View File

@ -361,7 +361,6 @@
{
"files": ["frontend_tests/**"],
"globals": {
"assert": false,
"document": false,
"reset_module": false,
"set_global": false,

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
const window_stub = $.create("window-stub");
set_global("to_$", () => window_stub);

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const params = {
alert_words: ["alertone", "alerttwo", "alertthree", "al*rt.*s", ".+", "emoji"],
};

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
set_global("channel", {});

View File

@ -1,10 +1,11 @@
"use strict";
const noop = () => {};
const {strict: assert} = require("assert");
const fs = require("fs");
const {JSDOM} = require("jsdom");
const noop = () => {};
const template = fs.readFileSync("templates/corporate/billing.html", "utf-8");
const dom = new JSDOM(template, {pretendToBeVisual: true});
const document = dom.window.document;

View File

@ -1,5 +1,6 @@
"use strict";
const {strict: assert} = require("assert");
const fs = require("fs");
const JQuery = require("jquery");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const blueslip_stacktrace = zrequire("blueslip_stacktrace");
run_test("clean_path", () => {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _settings_bots = {
render_bots: () => {},
};

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _ = require("lodash");
const _page_params = {};

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _ = require("lodash");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _ = require("lodash");
set_global("$", {});

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("color_data");
run_test("pick_color", () => {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("colorspace");
run_test("sRGB_to_linear", () => {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const noop = () => {};
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _ = require("lodash");
zrequire("keydown_util");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const {JSDOM} = require("jsdom");
const rewiremock = require("rewiremock/node");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const noop = function () {};
const return_false = function () {
return false;

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("stream_data");
const people = zrequire("people");
zrequire("compose_fade");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
const people = zrequire("people");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const autosize = require("autosize");
zrequire("compose_ui");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const emoji = zrequire("emoji", "shared/js/emoji");
const typeahead = zrequire("typeahead", "shared/js/typeahead");
zrequire("compose_state");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
global.stub_out_jquery();
set_global("page_params", {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const noop = function () {};
const events = require("./lib/events");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const events = require("./lib/events");
const event_fixtures = events.fixtures;

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const XDate = require("xdate");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("dropdown_list_widget");
zrequire("scroll_util");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
set_global("markdown", {});
set_global("local_message", {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json");
const events = require("./lib/events");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _ = require("lodash");
const emoji = zrequire("emoji", "shared/js/emoji");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const fenced_code = zrequire("fenced_code", "shared/js/fenced_code");
run_test("get_unused_fence", () => {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const FetchStatus = zrequire("fetch_status");
set_global("message_scroll", {
hide_loading_older: () => {},

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("unread");
zrequire("stream_data");
const people = zrequire("people");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const {FoldDict} = zrequire("fold_dict");
run_test("basic", () => {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
// This is a general tour of how to write node tests that
// may also give you some quick insight on how the Zulip
// browser app is constructed. Let's start with testing

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("hash_util");
zrequire("stream_data");
const people = zrequire("people");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
const window_stub = $.create("window-stub");
set_global("location", {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
// Important note on these tests:
//
// The way the Zulip hotkey tests work is as follows. First, we set

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("templates");
// We download our translations in `page_params` (which

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
zrequire("input_pill");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const {LazySet} = zrequire("lazy_set");
/*

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("rows");
zrequire("lightbox");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("list_cursor");
run_test("config errors", () => {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("list_render");
// We need these stubs to get by instanceof checks.

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("hash_util");
const emoji = zrequire("emoji", "shared/js/emoji");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("document", null);
set_global("page_params", {
realm_community_topic_editing_limit_seconds: 86400,

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("message_events");
zrequire("message_store");
zrequire("muting");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _ = require("lodash");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("unread");
zrequire("unread_ops");
zrequire("message_flags");

View File

@ -1,5 +1,6 @@
"use strict";
const {strict: assert} = require("assert");
// These unit tests for static/js/message_list.js emphasize the model-ish
// aspects of the MessageList class. We have to stub out a few functions
// related to views and events to get the tests working.

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("unread");
zrequire("Filter", "js/filter");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _ = require("lodash");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const util = zrequire("util");
zrequire("pm_conversations");
const people = zrequire("people");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("timerender");
zrequire("muting");
zrequire("stream_data");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
zrequire("hash_util");
zrequire("hashchange");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const util = zrequire("util");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("Filter", "js/filter");
zrequire("FetchStatus", "js/fetch_status");
zrequire("MessageListData", "js/message_list_data");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const people = zrequire("people");
zrequire("Filter", "js/filter");
zrequire("stream_data");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("Filter", "js/filter");
const people = zrequire("people");
zrequire("stream_data");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const rewiremock = require("rewiremock/node");
// Dependencies

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("zxcvbn", zrequire("zxcvbn", "zxcvbn"));
zrequire("common");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _ = require("lodash");
const moment = require("moment-timezone");
const rewiremock = require("rewiremock/node");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const people = zrequire("people");
const return_false = function () {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const pmc = zrequire("pm_conversations");
run_test("partners", () => {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
set_global("narrow_state", {});

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("poll_widget");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const rewiremock = require("rewiremock/node");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const XDate = require("xdate");
const people = zrequire("people");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("document", "document-stub");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const rs = zrequire("recent_senders");
let next_id = 0;

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("message_util");
const noop = () => {};

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const rm = zrequire("rendered_markdown");
const people = zrequire("people");
zrequire("user_groups");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const rtl = zrequire("rtl");
run_test("get_direction", () => {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("schema");
run_test("basics", () => {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("scroll_util");
set_global("ui", {
get_scroll_element: (element) => element,

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("page_params", {
search_pills_enabled: true,
});

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("page_params", {
search_pills_enabled: false,
});

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("search_pill");
zrequire("input_pill");
zrequire("Filter", "js/filter");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("page_params", {
search_pills_enabled: true,
});

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("page_params", {
search_pills_enabled: false,
});

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const noop = function () {};
set_global("document", {});

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const rewiremock = require("rewiremock/node");
set_global("page_params", {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const settings_data = zrequire("settings_data");
const settings_config = zrequire("settings_config");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
set_global("upload_widget", {});
zrequire("settings_emoji");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
set_global("XDate", zrequire("XDate", "xdate"));

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const rewiremock = require("rewiremock/node");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const rewiremock = require("rewiremock/node");
set_global("page_params", {});

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _ = require("lodash");
zrequire("user_pill");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("$", global.make_zjquery());
zrequire("spoilers");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const _ = require("lodash");
set_global("page_params", {

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const {LazySet} = zrequire("lazy_set");
const noop = () => {};

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const noop = function () {};
const return_true = function () {
return true;

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
set_global("document", "document-stub");
set_global("$", global.make_zjquery());

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("stream_data");
zrequire("stream_pill");

View File

@ -1,5 +1,6 @@
"use strict";
const {strict: assert} = require("assert");
// This tests the stream searching functionality which currently
// lives in stream_list.js.

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("stream_data");
zrequire("stream_sort");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("unread");
zrequire("stream_data");
zrequire("stream_topic_history");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
zrequire("submessage");
set_global("channel", {});

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
global.stub_out_jquery();
set_global("ui", {

View File

@ -1,5 +1,6 @@
"use strict";
const {strict: assert} = require("assert");
const fs = require("fs");
const {JSDOM} = require("jsdom");

View File

@ -1,5 +1,7 @@
"use strict";
const {strict: assert} = require("assert");
const moment = require("moment");
const XDate = require("xdate");

Some files were not shown because too many files have changed in this diff Show More