mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
node_tests: Use a spec-compliant FormData implementation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
e0b593f67e
commit
d4923a12e1
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
const {strict: assert} = require("assert");
|
const {strict: assert} = require("assert");
|
||||||
|
|
||||||
|
const {FormData} = require("formdata-node");
|
||||||
|
|
||||||
const {$t} = require("../zjsunit/i18n");
|
const {$t} = require("../zjsunit/i18n");
|
||||||
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
@@ -25,14 +27,7 @@ mock_esm("../../static/js/loading", {
|
|||||||
destroy_indicator: noop,
|
destroy_indicator: noop,
|
||||||
});
|
});
|
||||||
|
|
||||||
set_global(
|
set_global("FormData", FormData);
|
||||||
"FormData",
|
|
||||||
class FormData {
|
|
||||||
append(field, val) {
|
|
||||||
this[field] = val;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const settings_config = zrequire("settings_config");
|
const settings_config = zrequire("settings_config");
|
||||||
const settings_bots = zrequire("settings_bots");
|
const settings_bots = zrequire("settings_bots");
|
||||||
@@ -280,9 +275,9 @@ function test_upload_realm_icon(override, upload_realm_logo_or_icon) {
|
|||||||
override(channel, "post", (req) => {
|
override(channel, "post", (req) => {
|
||||||
posted = true;
|
posted = true;
|
||||||
assert.equal(req.url, "/json/realm/icon");
|
assert.equal(req.url, "/json/realm/icon");
|
||||||
assert.equal(req.data.csrfmiddlewaretoken, "token-stub");
|
assert.equal(req.data.get("csrfmiddlewaretoken"), "token-stub");
|
||||||
assert.equal(req.data["file-0"], "image1.png");
|
assert.equal(req.data.get("file-0"), "image1.png");
|
||||||
assert.equal(req.data["file-1"], "image2.png");
|
assert.equal(req.data.get("file-1"), "image2.png");
|
||||||
});
|
});
|
||||||
|
|
||||||
upload_realm_logo_or_icon(file_input, null, true);
|
upload_realm_logo_or_icon(file_input, null, true);
|
||||||
|
|||||||
@@ -110,6 +110,7 @@
|
|||||||
"eslint-plugin-import": "^2.22.0",
|
"eslint-plugin-import": "^2.22.0",
|
||||||
"eslint-plugin-no-jquery": "^2.7.0",
|
"eslint-plugin-no-jquery": "^2.7.0",
|
||||||
"eslint-plugin-unicorn": "^43.0.0",
|
"eslint-plugin-unicorn": "^43.0.0",
|
||||||
|
"formdata-node": "^4.3.3",
|
||||||
"jsdom": "^20.0.0",
|
"jsdom": "^20.0.0",
|
||||||
"mockdate": "^3.0.2",
|
"mockdate": "^3.0.2",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
|
|||||||
@@ -48,4 +48,4 @@ API_FEATURE_LEVEL = 139
|
|||||||
# historical commits sharing the same major version, in which case a
|
# historical commits sharing the same major version, in which case a
|
||||||
# minor version bump suffices.
|
# minor version bump suffices.
|
||||||
|
|
||||||
PROVISION_VERSION = (198, 0)
|
PROVISION_VERSION = (198, 1)
|
||||||
|
|||||||
18
yarn.lock
18
yarn.lock
@@ -5097,6 +5097,14 @@ form-data@^4.0.0:
|
|||||||
combined-stream "^1.0.8"
|
combined-stream "^1.0.8"
|
||||||
mime-types "^2.1.12"
|
mime-types "^2.1.12"
|
||||||
|
|
||||||
|
formdata-node@^4.3.3:
|
||||||
|
version "4.3.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-4.3.3.tgz#21415225be66e2c87a917bfc0fedab30a119c23c"
|
||||||
|
integrity sha512-coTew7WODO2vF+XhpUdmYz4UBvlsiTMSNaFYZlrXIqYbFd4W7bMwnoALNLE6uvNgzTg2j1JDF0ZImEfF06VPAA==
|
||||||
|
dependencies:
|
||||||
|
node-domexception "1.0.0"
|
||||||
|
web-streams-polyfill "4.0.0-beta.1"
|
||||||
|
|
||||||
forwarded@0.2.0:
|
forwarded@0.2.0:
|
||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
|
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811"
|
||||||
@@ -7306,6 +7314,11 @@ no-case@^3.0.4:
|
|||||||
lower-case "^2.0.2"
|
lower-case "^2.0.2"
|
||||||
tslib "^2.0.3"
|
tslib "^2.0.3"
|
||||||
|
|
||||||
|
node-domexception@1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
|
||||||
|
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
|
||||||
|
|
||||||
node-fetch@2.6.7, node-fetch@^2.6.1:
|
node-fetch@2.6.7, node-fetch@^2.6.1:
|
||||||
version "2.6.7"
|
version "2.6.7"
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
|
||||||
@@ -10648,6 +10661,11 @@ weak-map@^1.0.5:
|
|||||||
resolved "https://registry.yarnpkg.com/weak-map/-/weak-map-1.0.8.tgz#394c18a9e8262e790544ed8b55c6a4ddad1cb1a3"
|
resolved "https://registry.yarnpkg.com/weak-map/-/weak-map-1.0.8.tgz#394c18a9e8262e790544ed8b55c6a4ddad1cb1a3"
|
||||||
integrity sha512-lNR9aAefbGPpHO7AEnY0hCFjz1eTkWCXYvkTRrTHs9qv8zJp+SkVYpzfLIFXQQiG3tVvbNFQgVg2bQS8YGgxyw==
|
integrity sha512-lNR9aAefbGPpHO7AEnY0hCFjz1eTkWCXYvkTRrTHs9qv8zJp+SkVYpzfLIFXQQiG3tVvbNFQgVg2bQS8YGgxyw==
|
||||||
|
|
||||||
|
web-streams-polyfill@4.0.0-beta.1:
|
||||||
|
version "4.0.0-beta.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz#3b19b9817374b7cee06d374ba7eeb3aeb80e8c95"
|
||||||
|
integrity sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ==
|
||||||
|
|
||||||
webfonts-loader@^7.0.1:
|
webfonts-loader@^7.0.1:
|
||||||
version "7.5.2"
|
version "7.5.2"
|
||||||
resolved "https://registry.yarnpkg.com/webfonts-loader/-/webfonts-loader-7.5.2.tgz#9cdf86db9a24d07c6f9ad2fb59e7fa1e20fcfebb"
|
resolved "https://registry.yarnpkg.com/webfonts-loader/-/webfonts-loader-7.5.2.tgz#9cdf86db9a24d07c6f9ad2fb59e7fa1e20fcfebb"
|
||||||
|
|||||||
Reference in New Issue
Block a user