node_tests: Remove duplicate jQuery stubs.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-11-30 16:04:48 -08:00 committed by Steve Howell
parent ce42d1194d
commit 493294b2a9
7 changed files with 6 additions and 29 deletions

View File

@ -14,10 +14,6 @@ const template = fs.readFileSync("templates/corporate/billing.html", "utf-8");
const dom = new JSDOM(template, {pretendToBeVisual: true});
const document = dom.window.document;
let jquery_init;
set_global("$", (f) => {
jquery_init = f;
});
set_global("helpers", {
set_tab: noop,
});
@ -25,7 +21,6 @@ set_global("StripeCheckout", {
configure: noop,
});
zrequire("billing", "js/billing/billing");
set_global("$", make_zjquery());
run_test("initialize", () => {
@ -75,7 +70,7 @@ run_test("initialize", () => {
$("#payment-method").data = (key) =>
document.querySelector("#payment-method").getAttribute("data-" + key);
jquery_init();
zrequire("billing", "js/billing/billing");
assert(set_tab_called);
assert(stripe_checkout_configure_called);

View File

@ -4,11 +4,9 @@ const {strict: assert} = require("assert");
const {JSDOM} = require("jsdom");
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
stub_out_jquery();
set_global("page_params", {
development_environment: true,
});

View File

@ -2,14 +2,13 @@
const {strict: assert} = require("assert");
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {make_zjquery} = require("../zjsunit/zjquery");
zrequire("unread");
zrequire("stream_data");
const people = zrequire("people");
stub_out_jquery();
set_global("$", make_zjquery());
zrequire("message_util", "js/message_util");
zrequire("Filter", "js/filter");

View File

@ -13,8 +13,6 @@ set_global("page_params", {
is_guest: false,
});
set_global("$", () => {});
set_global("document", null);
stub_out_jquery();

View File

@ -3,12 +3,10 @@
const {strict: assert} = require("assert");
const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const {make_zjquery} = require("../zjsunit/zjquery");
stub_out_jquery();
set_global("ui", {
get_content_element: (element) => element,
get_scroll_element: (element) => element,

View File

@ -13,15 +13,10 @@ const template = fs.readFileSync("templates/analytics/realm_details.html", "utf-
const dom = new JSDOM(template, {pretendToBeVisual: true});
const document = dom.window.document;
let jquery_init;
set_global("$", (f) => {
jquery_init = f;
});
zrequire("support", "js/analytics/support");
set_global("$", make_zjquery());
run_test("scrub_realm", () => {
jquery_init();
zrequire("support", "js/analytics/support");
const click_handler = $("body").get_on_handler("click", ".scrub-realm-button");
const fake_this = $.create("fake-.scrub-realm-button");

View File

@ -13,11 +13,6 @@ const noop = () => {};
const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8");
const dom = new JSDOM(template, {pretendToBeVisual: true});
const document = dom.window.document;
let jquery_init;
set_global("$", (f) => {
jquery_init = f;
});
set_global("helpers", {
set_tab: noop,
@ -35,7 +30,6 @@ set_global("page_params", {
});
zrequire("helpers", "js/billing/helpers");
zrequire("upgrade", "js/billing/upgrade");
set_global("$", make_zjquery());
run_test("initialize", () => {
@ -109,7 +103,7 @@ run_test("initialize", () => {
$("#autopay-form").data = (key) =>
document.querySelector("#autopay-form").getAttribute("data-" + key);
jquery_init();
zrequire("upgrade", "js/billing/upgrade");
const e = {
preventDefault: noop,