mirror of https://github.com/zulip/zulip.git
tests: Rename the Node tests to *.cjs.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
30eabb9d6c
commit
687f1b1651
|
@ -381,9 +381,9 @@ node test fixtures and our OpenAPI documentation.
|
||||||
#### Node testing
|
#### Node testing
|
||||||
|
|
||||||
Once you've completed backend testing, be sure to add an example event
|
Once you've completed backend testing, be sure to add an example event
|
||||||
in `web/tests/lib/events.js`, a test of the
|
in `web/tests/lib/events.cjs`, a test of the
|
||||||
`server_events_dispatch.js` code for that event in
|
`server_events_dispatch.js` code for that event in
|
||||||
`web/tests/dispatch.test.js`, and verify your example
|
`web/tests/dispatch.test.cjs`, and verify your example
|
||||||
against the two versions of the schema that you declared above using
|
against the two versions of the schema that you declared above using
|
||||||
`tools/check-schemas`.
|
`tools/check-schemas`.
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ message is sent). As a result, we try to make sure that
|
||||||
The Python-Markdown implementation is tested by
|
The Python-Markdown implementation is tested by
|
||||||
`zerver/tests/test_markdown.py`, and the marked.js implementation and
|
`zerver/tests/test_markdown.py`, and the marked.js implementation and
|
||||||
`markdown.contains_backend_only_syntax` are tested by
|
`markdown.contains_backend_only_syntax` are tested by
|
||||||
`web/tests/markdown.test.js`.
|
`web/tests/markdown.test.cjs`.
|
||||||
|
|
||||||
A shared set of fixed test data ("test fixtures") is present in
|
A shared set of fixed test data ("test fixtures") is present in
|
||||||
`zerver/tests/fixtures/markdown_test_cases.json`, and is automatically used
|
`zerver/tests/fixtures/markdown_test_cases.json`, and is automatically used
|
||||||
|
|
|
@ -18,7 +18,7 @@ name when debugging something.
|
||||||
|
|
||||||
The JS unit tests are written to work with node. You can find them
|
The JS unit tests are written to work with node. You can find them
|
||||||
in `web/tests`. Here is an example test from
|
in `web/tests`. Here is an example test from
|
||||||
`web/tests/stream_data.test.js`:
|
`web/tests/stream_data.test.cjs`:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
(function test_get_by_id() {
|
(function test_get_by_id() {
|
||||||
|
@ -45,7 +45,7 @@ there are, you should strive to follow the patterns of the existing tests
|
||||||
and add your own tests.
|
and add your own tests.
|
||||||
|
|
||||||
A good first test to read is
|
A good first test to read is
|
||||||
[example1.js](https://github.com/zulip/zulip/blob/main/web/tests/example1.test.js).
|
[example1.test.cjs](https://github.com/zulip/zulip/blob/main/web/tests/example1.test.cjs).
|
||||||
(And then there are several other example files.)
|
(And then there are several other example files.)
|
||||||
|
|
||||||
## How the node tests work
|
## How the node tests work
|
||||||
|
@ -60,10 +60,10 @@ those slow down the tests a lot, and often don't add much value.
|
||||||
Instead, the preferred model for our unit tests is to mock DOM
|
Instead, the preferred model for our unit tests is to mock DOM
|
||||||
manipulations (which in Zulip are almost exclusively done via
|
manipulations (which in Zulip are almost exclusively done via
|
||||||
`jQuery`) using a custom library
|
`jQuery`) using a custom library
|
||||||
[zjquery](https://github.com/zulip/zulip/blob/main/web/tests/lib/zjquery.js).
|
[zjquery](https://github.com/zulip/zulip/blob/main/web/tests/lib/zjquery.cjs).
|
||||||
|
|
||||||
The
|
The
|
||||||
[unit test file](https://github.com/zulip/zulip/blob/main/web/tests/zjquery.test.js)
|
[unit test file](https://github.com/zulip/zulip/blob/main/web/tests/zjquery.test.cjs)
|
||||||
for `zjquery` is designed to be also serve as nice documentation for
|
for `zjquery` is designed to be also serve as nice documentation for
|
||||||
how to use `zjquery`, and is **highly recommended reading** for anyone
|
how to use `zjquery`, and is **highly recommended reading** for anyone
|
||||||
working on or debugging the Zulip node tests.
|
working on or debugging the Zulip node tests.
|
||||||
|
@ -149,7 +149,7 @@ narrow_state.stream = function () {
|
||||||
|
|
||||||
## Creating new test modules
|
## Creating new test modules
|
||||||
|
|
||||||
The test runner (`index.js`) automatically runs all .js files in the
|
The test runner (`index.cjs`) automatically runs all .test.cjs files in the
|
||||||
`web/tests` directory, so you can simply start editing a file
|
`web/tests` directory, so you can simply start editing a file
|
||||||
in that directory to create a new test.
|
in that directory to create a new test.
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ These instructions assume you're using the Vagrant development environment.
|
||||||
1. **Set the `Node.js interpreter path` to `/usr/local/bin/node`**
|
1. **Set the `Node.js interpreter path` to `/usr/local/bin/node`**
|
||||||
1. Hit `OK` 2 times to get back to the `Run/Debug Configurations` window.
|
1. Hit `OK` 2 times to get back to the `Run/Debug Configurations` window.
|
||||||
1. Under `Working Directory` select the root `zulip` directory.
|
1. Under `Working Directory` select the root `zulip` directory.
|
||||||
1. Under `JavaScript file`, enter `web/tests/lib/index.js`
|
1. Under `JavaScript file`, enter `web/tests/lib/index.cjs`
|
||||||
-- this is the root script for Zulip's node unit tests.
|
-- this is the root script for Zulip's node unit tests.
|
||||||
|
|
||||||
Congratulations! You've now set up the integration.
|
Congratulations! You've now set up the integration.
|
||||||
|
@ -288,7 +288,7 @@ Congratulations! You've now set up the integration.
|
||||||
To use Webstorm to debug a given node test file, do the following:
|
To use Webstorm to debug a given node test file, do the following:
|
||||||
|
|
||||||
1. Under `Application parameters` choose the node test file that you
|
1. Under `Application parameters` choose the node test file that you
|
||||||
are trying to test (e.g., `web/tests/message_store.test.js`).
|
are trying to test (e.g., `web/tests/message_store.test.cjs`).
|
||||||
1. Under `Path Mappings`, set `Project Root` to `/srv/zulip`
|
1. Under `Path Mappings`, set `Project Root` to `/srv/zulip`
|
||||||
(i.e. where the `zulip` Git repository is mounted in the Vagrant guest).
|
(i.e. where the `zulip` Git repository is mounted in the Vagrant guest).
|
||||||
1. Use the WebStorm debugger; see [this overview][webstorm-debugging]
|
1. Use the WebStorm debugger; see [this overview][webstorm-debugging]
|
||||||
|
|
|
@ -62,7 +62,7 @@ organization in Zulip). The following files are involved in the process:
|
||||||
|
|
||||||
- `web/e2e-tests/admin.test.ts`: end-to-end tests for the organization
|
- `web/e2e-tests/admin.test.ts`: end-to-end tests for the organization
|
||||||
admin settings pages.
|
admin settings pages.
|
||||||
- `web/tests/dispatch.test.js`
|
- `web/tests/dispatch.test.cjs`
|
||||||
|
|
||||||
**Documentation**
|
**Documentation**
|
||||||
|
|
||||||
|
@ -668,11 +668,11 @@ frontend tests: [node-based unit tests](../testing/testing-with-node.md) and
|
||||||
|
|
||||||
At the minimum, if you created a new function to update UI in
|
At the minimum, if you created a new function to update UI in
|
||||||
`settings_org.ts`, you will need to mock that function in
|
`settings_org.ts`, you will need to mock that function in
|
||||||
`web/tests/dispatch.test.js`. Add the name of the UI
|
`web/tests/dispatch.test.cjs`. Add the name of the UI
|
||||||
function you created to the following object with `noop` as the value:
|
function you created to the following object with `noop` as the value:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// web/tests/dispatch.test.js
|
// web/tests/dispatch.test.cjs
|
||||||
|
|
||||||
set_global('settings_org', {
|
set_global('settings_org', {
|
||||||
update_email_change_display: noop,
|
update_email_change_display: noop,
|
||||||
|
|
|
@ -23,7 +23,7 @@ TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
|
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
|
||||||
ROOT_DIR = os.path.dirname(TOOLS_DIR)
|
ROOT_DIR = os.path.dirname(TOOLS_DIR)
|
||||||
|
|
||||||
EVENTS_JS = "web/tests/lib/events.js"
|
EVENTS_JS = "web/tests/lib/events.cjs"
|
||||||
|
|
||||||
# check for the venv
|
# check for the venv
|
||||||
from tools.lib import sanity_check
|
from tools.lib import sanity_check
|
||||||
|
|
|
@ -207,7 +207,7 @@ js_rules = RuleList(
|
||||||
"exclude_pattern": r"(const |\S)style ?=",
|
"exclude_pattern": r"(const |\S)style ?=",
|
||||||
"description": "Avoid using the `style=` attribute; we prefer styling in CSS files",
|
"description": "Avoid using the `style=` attribute; we prefer styling in CSS files",
|
||||||
"exclude": {
|
"exclude": {
|
||||||
"web/tests/copy_and_paste.test.js",
|
"web/tests/copy_and_paste.test.cjs",
|
||||||
},
|
},
|
||||||
"good_lines": ["#my-style {color: blue;}", "const style =", 'some_style = "test"'],
|
"good_lines": ["#my-style {color: blue;}", "const style =", 'some_style = "test"'],
|
||||||
"bad_lines": ['<p style="color: blue;">Foo</p>', 'style = "color: blue;"'],
|
"bad_lines": ['<p style="color: blue;">Foo</p>', 'style = "color: blue;"'],
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const events = require("../../web/tests/lib/events.js");
|
const events = require("../../web/tests/lib/events.cjs");
|
||||||
|
|
||||||
console.info(JSON.stringify(events.fixtures, null, 4));
|
console.info(JSON.stringify(events.fixtures, null, 4));
|
||||||
|
|
|
@ -20,7 +20,7 @@ sanity_check.check_venv(__file__)
|
||||||
import orjson
|
import orjson
|
||||||
from zulint.printer import BOLDRED, CYAN, ENDC, GREEN
|
from zulint.printer import BOLDRED, CYAN, ENDC, GREEN
|
||||||
|
|
||||||
INDEX_JS = os.path.join(ROOT_DIR, "web/tests/lib/index.js")
|
INDEX_JS = os.path.join(ROOT_DIR, "web/tests/lib/index.cjs")
|
||||||
NODE_COVERAGE_PATH = os.path.join(ROOT_DIR, "var/node-coverage/coverage-final.json")
|
NODE_COVERAGE_PATH = os.path.join(ROOT_DIR, "var/node-coverage/coverage-final.json")
|
||||||
|
|
||||||
# Ideally, we wouldn't need this line, but it seems to be required to
|
# Ideally, we wouldn't need this line, but it seems to be required to
|
||||||
|
@ -29,7 +29,7 @@ os.chdir(ROOT_DIR)
|
||||||
|
|
||||||
USAGE = """
|
USAGE = """
|
||||||
tools/test-js-with-node - to run all tests
|
tools/test-js-with-node - to run all tests
|
||||||
tools/test-js-with-node util.test.js activity.test.js - to run just a couple tests
|
tools/test-js-with-node util.test.cjs activity.test.cjs - to run just a couple tests
|
||||||
tools/test-js-with-node --coverage - to generate coverage report
|
tools/test-js-with-node --coverage - to generate coverage report
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -291,14 +291,14 @@ EXEMPT_FILES = make_set(
|
||||||
"web/src/zcommand.ts",
|
"web/src/zcommand.ts",
|
||||||
"web/src/zform.js",
|
"web/src/zform.js",
|
||||||
"web/src/zulip_test.ts",
|
"web/src/zulip_test.ts",
|
||||||
"web/tests/lib/example_user.js",
|
"web/tests/lib/example_user.cjs",
|
||||||
"web/tests/lib/mdiff.js",
|
"web/tests/lib/mdiff.cjs",
|
||||||
"web/tests/lib/real_jquery.js",
|
"web/tests/lib/real_jquery.cjs",
|
||||||
"web/tests/lib/zjquery_element.js",
|
"web/tests/lib/zjquery_element.cjs",
|
||||||
"web/tests/lib/zpage_billing_params.js",
|
"web/tests/lib/zpage_billing_params.cjs",
|
||||||
# There are some important functions which are not called right now but will
|
# There are some important functions which are not called right now but will
|
||||||
# be reused when we add tests for dropdown widget so it doesn't make sense to remove them.
|
# be reused when we add tests for dropdown widget so it doesn't make sense to remove them.
|
||||||
"web/tests/recent_view.test.js",
|
"web/tests/recent_view.test.cjs",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -362,8 +362,8 @@ def print_error(msg: str) -> None:
|
||||||
|
|
||||||
def clean_file(orig_fn: str) -> str:
|
def clean_file(orig_fn: str) -> str:
|
||||||
fn = orig_fn
|
fn = orig_fn
|
||||||
if not fn.endswith(".test.js"):
|
if not fn.endswith(".test.cjs"):
|
||||||
fn += ".test.js"
|
fn += ".test.cjs"
|
||||||
if "web/tests/" not in fn:
|
if "web/tests/" not in fn:
|
||||||
fn = os.path.join(ROOT_DIR, "web", "tests", fn)
|
fn = os.path.join(ROOT_DIR, "web", "tests", fn)
|
||||||
fn = os.path.abspath(fn)
|
fn = os.path.abspath(fn)
|
||||||
|
@ -381,7 +381,7 @@ def clean_files(fns: list[str]) -> list[str]:
|
||||||
def run_tests_via_node_js() -> int:
|
def run_tests_via_node_js() -> int:
|
||||||
os.environ["TZ"] = "UTC"
|
os.environ["TZ"] = "UTC"
|
||||||
|
|
||||||
# The index.js test runner is the real "driver" here, and we launch
|
# The index.cjs test runner is the real "driver" here, and we launch
|
||||||
# with either nyc or node, depending on whether we want coverage
|
# with either nyc or node, depending on whether we want coverage
|
||||||
# reports. Running under nyc is slower and creates funny
|
# reports. Running under nyc is slower and creates funny
|
||||||
# tracebacks, so you generally want to get coverage reports only
|
# tracebacks, so you generally want to get coverage reports only
|
||||||
|
@ -393,7 +393,7 @@ def run_tests_via_node_js() -> int:
|
||||||
parallel = 1
|
parallel = 1
|
||||||
files = individual_files
|
files = individual_files
|
||||||
else:
|
else:
|
||||||
files = sorted(glob.glob(os.path.join(ROOT_DIR, "web/tests/*.test.js")))
|
files = sorted(glob.glob(os.path.join(ROOT_DIR, "web/tests/*.test.cjs")))
|
||||||
|
|
||||||
test_files = clean_files(files)
|
test_files = clean_files(files)
|
||||||
|
|
||||||
|
@ -417,14 +417,15 @@ def run_tests_via_node_js() -> int:
|
||||||
coverage_dir = os.path.join(ROOT_DIR, "var/node-coverage")
|
coverage_dir = os.path.join(ROOT_DIR, "var/node-coverage")
|
||||||
|
|
||||||
nyc = os.path.join(ROOT_DIR, "node_modules/.bin/nyc")
|
nyc = os.path.join(ROOT_DIR, "node_modules/.bin/nyc")
|
||||||
command = [nyc, "--extension", ".hbs", "--extension", ".ts"]
|
command = [nyc]
|
||||||
|
command += [f"--extension={ext}" for ext in [".cjs", ".cts", ".hbs", ".mjs", ".mts", ".ts"]]
|
||||||
command += ["--report-dir", coverage_dir]
|
command += ["--report-dir", coverage_dir]
|
||||||
command += ["--temp-directory", coverage_dir]
|
command += ["--temp-directory", coverage_dir]
|
||||||
command += ["-r=lcov", "-r=json", "-r=text-summary"]
|
command += ["-r=lcov", "-r=json", "-r=text-summary"]
|
||||||
command += node_tests_cmd
|
command += node_tests_cmd
|
||||||
else:
|
else:
|
||||||
# Normal testing, no coverage analysis.
|
# Normal testing, no coverage analysis.
|
||||||
# Run the index.js test runner, which runs all the other tests.
|
# Run the index.cjs test runner, which runs all the other tests.
|
||||||
command = node_tests_cmd
|
command = node_tests_cmd
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -473,8 +474,8 @@ def enforce_proper_coverage(coverage_json: Any) -> bool:
|
||||||
*glob.glob("web/src/*.js"),
|
*glob.glob("web/src/*.js"),
|
||||||
*glob.glob("web/src/*.ts"),
|
*glob.glob("web/src/*.ts"),
|
||||||
*glob.glob("web/src/billing/*.js"),
|
*glob.glob("web/src/billing/*.js"),
|
||||||
*glob.glob("web/tests/*.js"),
|
*glob.glob("web/tests/*.cjs"),
|
||||||
*glob.glob("web/tests/lib/*.js"),
|
*glob.glob("web/tests/lib/*.cjs"),
|
||||||
}
|
}
|
||||||
missing_files = sorted(EXEMPT_FILES - all_js_files)
|
missing_files = sorted(EXEMPT_FILES - all_js_files)
|
||||||
assert not missing_files, f"Missing files should be removed from EXEMPT_FILES: {missing_files}"
|
assert not missing_files, f"Missing files should be removed from EXEMPT_FILES: {missing_files}"
|
||||||
|
|
|
@ -8,12 +8,12 @@ const {
|
||||||
buddy_list_add_user_matching_view,
|
buddy_list_add_user_matching_view,
|
||||||
buddy_list_add_other_user,
|
buddy_list_add_other_user,
|
||||||
stub_buddy_list_elements,
|
stub_buddy_list_elements,
|
||||||
} = require("./lib/buddy_list.js");
|
} = require("./lib/buddy_list.cjs");
|
||||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
const $window_stub = $.create("window-stub");
|
const $window_stub = $.create("window-stub");
|
||||||
set_global("to_$", () => $window_stub);
|
set_global("to_$", () => $window_stub);
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {set_global, zrequire} = require("./lib/namespace.js");
|
const {set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
set_global("page_params", {
|
set_global("page_params", {
|
||||||
is_spectator: false,
|
is_spectator: false,
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {$t} = require("./lib/i18n.js");
|
const {$t} = require("./lib/i18n.cjs");
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
const channel = mock_esm("../src/channel");
|
const channel = mock_esm("../src/channel");
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const blueslip_stacktrace = zrequire("blueslip_stacktrace");
|
const blueslip_stacktrace = zrequire("blueslip_stacktrace");
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const bot_data = zrequire("bot_data");
|
const bot_data = zrequire("bot_data");
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {make_stub} = require("./lib/stub.js");
|
const {make_stub} = require("./lib/stub.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
|
|
||||||
window.location.hash = "#bogus";
|
window.location.hash = "#bogus";
|
||||||
|
|
|
@ -4,9 +4,9 @@ const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const _ = require("lodash");
|
const _ = require("lodash");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
mock_esm("../src/settings_data", {
|
mock_esm("../src/settings_data", {
|
||||||
user_can_access_all_other_users: () => true,
|
user_can_access_all_other_users: () => true,
|
||||||
|
@ -35,7 +35,7 @@ const user_settings = {};
|
||||||
initialize_user_settings({user_settings});
|
initialize_user_settings({user_settings});
|
||||||
|
|
||||||
// The buddy_data module is mostly tested indirectly through
|
// The buddy_data module is mostly tested indirectly through
|
||||||
// activity.test.js, but we should feel free to add direct tests
|
// activity.test.cjs, but we should feel free to add direct tests
|
||||||
// here.
|
// here.
|
||||||
|
|
||||||
const selma = {
|
const selma = {
|
|
@ -10,11 +10,11 @@ const {
|
||||||
buddy_list_add_user_matching_view,
|
buddy_list_add_user_matching_view,
|
||||||
buddy_list_add_other_user,
|
buddy_list_add_other_user,
|
||||||
stub_buddy_list_elements,
|
stub_buddy_list_elements,
|
||||||
} = require("./lib/buddy_list.js");
|
} = require("./lib/buddy_list.cjs");
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
const padded_widget = mock_esm("../src/padded_widget");
|
const padded_widget = mock_esm("../src/padded_widget");
|
||||||
const message_viewport = mock_esm("../src/message_viewport");
|
const message_viewport = mock_esm("../src/message_viewport");
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_jquery, mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_jquery, mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
const xhr_401 = {
|
const xhr_401 = {
|
||||||
status: 401,
|
status: 401,
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const color_data = zrequire("color_data");
|
const color_data = zrequire("color_data");
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
mock_esm("tippy.js", {
|
mock_esm("tippy.js", {
|
||||||
default(arg) {
|
default(arg) {
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {$t} = require("./lib/i18n.js");
|
const {$t} = require("./lib/i18n.cjs");
|
||||||
const {mock_jquery, zrequire} = require("./lib/namespace.js");
|
const {mock_jquery, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
|
|
||||||
let env;
|
let env;
|
||||||
|
|
|
@ -4,11 +4,11 @@ const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const MockDate = require("mockdate");
|
const MockDate = require("mockdate");
|
||||||
|
|
||||||
const {mock_banners} = require("./lib/compose_banner.js");
|
const {mock_banners} = require("./lib/compose_banner.cjs");
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
const user_groups = zrequire("user_groups");
|
const user_groups = zrequire("user_groups");
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_banners} = require("./lib/compose_banner.js");
|
const {mock_banners} = require("./lib/compose_banner.cjs");
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
const user_groups = zrequire("user_groups");
|
const user_groups = zrequire("user_groups");
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
// Setup
|
// Setup
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
// Mocking and stubbing things
|
// Mocking and stubbing things
|
||||||
set_global("document", "document-stub");
|
set_global("document", "document-stub");
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_jquery, zrequire} = require("./lib/namespace.js");
|
const {mock_jquery, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
mock_jquery((selector) => {
|
mock_jquery((selector) => {
|
||||||
switch (selector) {
|
switch (selector) {
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
const input_pill = mock_esm("../src/input_pill");
|
const input_pill = mock_esm("../src/input_pill");
|
||||||
const people = zrequire("people");
|
const people = zrequire("people");
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
const compose_pm_pill = mock_esm("../src/compose_pm_pill");
|
const compose_pm_pill = mock_esm("../src/compose_pm_pill");
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {$t} = require("./lib/i18n.js");
|
const {$t} = require("./lib/i18n.cjs");
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
set_global("navigator", {});
|
set_global("navigator", {});
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_banners} = require("./lib/compose_banner.js");
|
const {mock_banners} = require("./lib/compose_banner.cjs");
|
||||||
const {$t} = require("./lib/i18n.js");
|
const {$t} = require("./lib/i18n.cjs");
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
const compose_banner = zrequire("compose_banner");
|
const compose_banner = zrequire("compose_banner");
|
||||||
const compose_pm_pill = zrequire("compose_pm_pill");
|
const compose_pm_pill = zrequire("compose_pm_pill");
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const events = require("./lib/events.js");
|
const events = require("./lib/events.cjs");
|
||||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
const channel = mock_esm("../src/channel");
|
const channel = mock_esm("../src/channel");
|
||||||
const compose_closed_ui = mock_esm("../src/compose_closed_ui");
|
const compose_closed_ui = mock_esm("../src/compose_closed_ui");
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_banners} = require("./lib/compose_banner.js");
|
const {mock_banners} = require("./lib/compose_banner.cjs");
|
||||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
let autosize_called;
|
let autosize_called;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const copy_and_paste = zrequire("copy_and_paste");
|
const copy_and_paste = zrequire("copy_and_paste");
|
||||||
const stream_data = zrequire("stream_data");
|
const stream_data = zrequire("stream_data");
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {set_global, zrequire} = require("./lib/namespace.js");
|
const {set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
set_global("navigator", {
|
set_global("navigator", {
|
||||||
userAgent: "",
|
userAgent: "",
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const events = require("./lib/events.js");
|
const events = require("./lib/events.cjs");
|
||||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {make_stub} = require("./lib/stub.js");
|
const {make_stub} = require("./lib/stub.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
const event_fixtures = events.fixtures;
|
const event_fixtures = events.fixtures;
|
||||||
const test_message = events.test_message;
|
const test_message = events.test_message;
|
||||||
|
@ -865,7 +865,7 @@ run_test("submessage", ({override}) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// For subscriptions, see dispatch_subs.test.js
|
// For subscriptions, see dispatch_subs.test.cjs
|
||||||
|
|
||||||
run_test("typing", ({override}) => {
|
run_test("typing", ({override}) => {
|
||||||
// Simulate that we are not typing.
|
// Simulate that we are not typing.
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const events = require("./lib/events.js");
|
const events = require("./lib/events.cjs");
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {make_stub} = require("./lib/stub.js");
|
const {make_stub} = require("./lib/stub.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
|
|
||||||
const event_fixtures = events.fixtures;
|
const event_fixtures = events.fixtures;
|
||||||
const test_user = events.test_user;
|
const test_user = events.test_user;
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_banners} = require("./lib/compose_banner.js");
|
const {mock_banners} = require("./lib/compose_banner.cjs");
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
const user_pill = mock_esm("../src/user_pill");
|
const user_pill = mock_esm("../src/user_pill");
|
||||||
const messages_overlay_ui = mock_esm("../src/messages_overlay_ui");
|
const messages_overlay_ui = mock_esm("../src/messages_overlay_ui");
|
|
@ -4,9 +4,9 @@ const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const MockDate = require("mockdate");
|
const MockDate = require("mockdate");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {make_stub} = require("./lib/stub.js");
|
const {make_stub} = require("./lib/stub.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const compose_notifications = mock_esm("../src/compose_notifications");
|
const compose_notifications = mock_esm("../src/compose_notifications");
|
||||||
const markdown = mock_esm("../src/markdown");
|
const markdown = mock_esm("../src/markdown");
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const events = require("./lib/events.js");
|
const events = require("./lib/events.cjs");
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
|
|
||||||
const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json");
|
const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json");
|
||||||
|
|
|
@ -4,8 +4,8 @@ const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const _ = require("lodash");
|
const _ = require("lodash");
|
||||||
|
|
||||||
const {zrequire, set_global} = require("./lib/namespace.js");
|
const {zrequire, set_global} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const emoji = zrequire("emoji");
|
const emoji = zrequire("emoji");
|
||||||
const emoji_picker = zrequire("emoji_picker");
|
const emoji_picker = zrequire("emoji_picker");
|
|
@ -9,10 +9,10 @@
|
||||||
// become clear as you keep reading.
|
// become clear as you keep reading.
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {make_stream} = require("./lib/example_stream.js");
|
const {make_stream} = require("./lib/example_stream.cjs");
|
||||||
const {make_user} = require("./lib/example_user.js");
|
const {make_user} = require("./lib/example_user.cjs");
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
// We will use our special zrequire helper to import the
|
// We will use our special zrequire helper to import the
|
||||||
// Zulip code. We use zrequire instead of require,
|
// Zulip code. We use zrequire instead of require,
|
||||||
|
@ -43,7 +43,7 @@ const isaac = make_user({
|
||||||
|
|
||||||
// The `people` object is a very fundamental object in the
|
// The `people` object is a very fundamental object in the
|
||||||
// Zulip app. You can learn a lot more about it by reading
|
// Zulip app. You can learn a lot more about it by reading
|
||||||
// the tests in people.test.js in the same directory as this file.
|
// the tests in people.test.cjs in the same directory as this file.
|
||||||
|
|
||||||
// Let's exercise the code and use assert to verify it works!
|
// Let's exercise the code and use assert to verify it works!
|
||||||
assert.ok(!people.is_known_user_id(isaac.user_id));
|
assert.ok(!people.is_known_user_id(isaac.user_id));
|
||||||
|
@ -74,4 +74,4 @@ run_test("verify stream_data persists stream color", () => {
|
||||||
const sub = stream_data.get_sub_by_name("Denmark");
|
const sub = stream_data.get_sub_by_name("Denmark");
|
||||||
assert.equal(sub.color, "a1a1a1");
|
assert.equal(sub.color, "a1a1a1");
|
||||||
});
|
});
|
||||||
// See example2.test.js in this directory.
|
// See example2.test.cjs in this directory.
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {make_stream} = require("./lib/example_stream.js");
|
const {make_stream} = require("./lib/example_stream.cjs");
|
||||||
const {make_user} = require("./lib/example_user.js");
|
const {make_user} = require("./lib/example_user.cjs");
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
// Hopefully the basic patterns for testing data-oriented modules
|
// Hopefully the basic patterns for testing data-oriented modules
|
||||||
// are starting to become apparent. To reinforce that, we will present
|
// are starting to become apparent. To reinforce that, we will present
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {make_stream} = require("./lib/example_stream.js");
|
const {make_stream} = require("./lib/example_stream.cjs");
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
// In the Zulip app you can narrow your message stream by topic, by
|
// In the Zulip app you can narrow your message stream by topic, by
|
||||||
// sender, by direct message recipient, by search keywords, etc.
|
// sender, by direct message recipient, by search keywords, etc.
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {make_bot} = require("./lib/example_user.js");
|
const {make_bot} = require("./lib/example_user.cjs");
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ const {run_test, noop} = require("./lib/test.js");
|
||||||
you are interested, all of these objects have test
|
you are interested, all of these objects have test
|
||||||
suites that have 100% line coverage on the modules
|
suites that have 100% line coverage on the modules
|
||||||
that implement those objects. For example, you can look
|
that implement those objects. For example, you can look
|
||||||
at people.test.js in this directory for more tests on the
|
at people.test.cjs in this directory for more tests on the
|
||||||
people object.
|
people object.
|
||||||
|
|
||||||
We can quickly review some testing concepts:
|
We can quickly review some testing concepts:
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {make_user} = require("./lib/example_user.js");
|
const {make_user} = require("./lib/example_user.cjs");
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Our test from an earlier example verifies that the update events
|
Our test from an earlier example verifies that the update events
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {make_stub} = require("./lib/stub.js");
|
const {make_stub} = require("./lib/stub.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The previous example was a bit extreme. Generally we just
|
The previous example was a bit extreme. Generally we just
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {make_stream} = require("./lib/example_stream.js");
|
const {make_stream} = require("./lib/example_stream.cjs");
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {make_user} = require("./lib/example_user.js");
|
const {make_user} = require("./lib/example_user.cjs");
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
mock_esm("../src/settings_data", {
|
mock_esm("../src/settings_data", {
|
||||||
user_can_access_all_other_users: () => true,
|
user_can_access_all_other_users: () => true,
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const fenced_code = zrequire("../shared/src/fenced_code");
|
const fenced_code = zrequire("../shared/src/fenced_code");
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
mock_esm("../src/message_feed_loading", {
|
mock_esm("../src/message_feed_loading", {
|
||||||
hide_loading_older() {},
|
hide_loading_older() {},
|
|
@ -4,11 +4,11 @@ const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {parseOneAddress} = require("email-addresses");
|
const {parseOneAddress} = require("email-addresses");
|
||||||
|
|
||||||
const {mock_esm, with_overrides, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
const message_store = mock_esm("../src/message_store");
|
const message_store = mock_esm("../src/message_store");
|
||||||
const user_topics = mock_esm("../src/user_topics");
|
const user_topics = mock_esm("../src/user_topics");
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const {FoldDict} = zrequire("fold_dict");
|
const {FoldDict} = zrequire("fold_dict");
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const gear_menu_util = zrequire("gear_menu_util");
|
const gear_menu_util = zrequire("gear_menu_util");
|
||||||
const {set_realm} = zrequire("state_data");
|
const {set_realm} = zrequire("state_data");
|
|
@ -4,8 +4,8 @@ const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const message_link_test_cases = require("../../zerver/tests/fixtures/message_link_test_cases.json");
|
const message_link_test_cases = require("../../zerver/tests/fixtures/message_link_test_cases.json");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const hash_parser = zrequire("hash_parser");
|
const hash_parser = zrequire("hash_parser");
|
||||||
const hash_util = zrequire("hash_util");
|
const hash_util = zrequire("hash_util");
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
let $window_stub;
|
let $window_stub;
|
||||||
set_global("to_$", () => $window_stub);
|
set_global("to_$", () => $window_stub);
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {make_stub} = require("./lib/stub.js");
|
const {make_stub} = require("./lib/stub.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
// Important note on these tests:
|
// Important note on these tests:
|
||||||
|
|
|
@ -4,9 +4,9 @@ const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const _ = require("lodash");
|
const _ = require("lodash");
|
||||||
|
|
||||||
const {unmock_module, zrequire} = require("./lib/namespace.js");
|
const {unmock_module, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
// We download our translations in `page_params` (which
|
// We download our translations in `page_params` (which
|
||||||
// are for the user's chosen language), so we simulate
|
// are for the user's chosen language), so we simulate
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
set_global("document", {});
|
set_global("document", {});
|
||||||
class ClipboardEvent {}
|
class ClipboardEvent {}
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const internal_url = zrequire("../shared/src/internal_url");
|
const internal_url = zrequire("../shared/src/internal_url");
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
const keydown_util = zrequire("keydown_util");
|
const keydown_util = zrequire("keydown_util");
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
|
|
||||||
const {LazySet} = zrequire("lazy_set");
|
const {LazySet} = zrequire("lazy_set");
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
mock_esm("../src/resize", {
|
mock_esm("../src/resize", {
|
||||||
resize_stream_filters_container() {},
|
resize_stream_filters_container() {},
|
|
@ -1,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const {noop} = require("./test.js");
|
const {noop} = require("./test.cjs");
|
||||||
const $ = require("./zjquery.js");
|
const $ = require("./zjquery.cjs");
|
||||||
|
|
||||||
let users_matching_view = [];
|
let users_matching_view = [];
|
||||||
exports.buddy_list_add_user_matching_view = (user_id, $stub) => {
|
exports.buddy_list_add_user_matching_view = (user_id, $stub) => {
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const compose_banner = require("../../src/compose_banner.ts");
|
const compose_banner = require("../../src/compose_banner.ts");
|
||||||
|
|
||||||
const {noop} = require("./test.js");
|
const {noop} = require("./test.cjs");
|
||||||
const $ = require("./zjquery.js");
|
const $ = require("./zjquery.cjs");
|
||||||
|
|
||||||
exports.mock_banners = () => {
|
exports.mock_banners = () => {
|
||||||
// zjquery doesn't support `remove`, which is used when clearing the compose box.
|
// zjquery doesn't support `remove`, which is used when clearing the compose box.
|
|
@ -8,14 +8,14 @@ require("handlebars/runtime.js");
|
||||||
const {JSDOM} = require("jsdom");
|
const {JSDOM} = require("jsdom");
|
||||||
const _ = require("lodash");
|
const _ = require("lodash");
|
||||||
|
|
||||||
const handlebars = require("./handlebars.js");
|
const handlebars = require("./handlebars.cjs");
|
||||||
const stub_i18n = require("./i18n.js");
|
const stub_i18n = require("./i18n.cjs");
|
||||||
const namespace = require("./namespace.js");
|
const namespace = require("./namespace.cjs");
|
||||||
const test = require("./test.js");
|
const test = require("./test.cjs");
|
||||||
const blueslip = require("./zblueslip.js");
|
const blueslip = require("./zblueslip.cjs");
|
||||||
const zjquery = require("./zjquery.js");
|
const zjquery = require("./zjquery.cjs");
|
||||||
const zpage_billing_params = require("./zpage_billing_params.js");
|
const zpage_billing_params = require("./zpage_billing_params.cjs");
|
||||||
const zpage_params = require("./zpage_params.js");
|
const zpage_params = require("./zpage_params.cjs");
|
||||||
|
|
||||||
process.env.NODE_ENV = "test";
|
process.env.NODE_ENV = "test";
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ require("../../src/templates.js"); // register Zulip extensions
|
||||||
async function run_one_module(file) {
|
async function run_one_module(file) {
|
||||||
zjquery.clear_initialize_function();
|
zjquery.clear_initialize_function();
|
||||||
zjquery.clear_all_elements();
|
zjquery.clear_all_elements();
|
||||||
console.info("running test " + path.basename(file, ".test.js"));
|
console.info("running test " + path.basename(file, ".test.cjs"));
|
||||||
test.set_current_file_name(file);
|
test.set_current_file_name(file);
|
||||||
test.suite.length = 0;
|
test.suite.length = 0;
|
||||||
require(file);
|
require(file);
|
|
@ -27,7 +27,7 @@ const assert = require("node:assert/strict");
|
||||||
const {JSDOM} = require("jsdom");
|
const {JSDOM} = require("jsdom");
|
||||||
const _ = require("lodash");
|
const _ = require("lodash");
|
||||||
|
|
||||||
const mdiff = require("./mdiff.js");
|
const mdiff = require("./mdiff.cjs");
|
||||||
|
|
||||||
// Module-level global instance of MarkdownComparer, initialized when needed
|
// Module-level global instance of MarkdownComparer, initialized when needed
|
||||||
let _markdownComparerInstance = null;
|
let _markdownComparerInstance = null;
|
|
@ -6,7 +6,7 @@ const path = require("node:path");
|
||||||
|
|
||||||
const callsites = require("callsites");
|
const callsites = require("callsites");
|
||||||
|
|
||||||
const $ = require("./zjquery.js");
|
const $ = require("./zjquery.cjs");
|
||||||
|
|
||||||
const new_globals = new Set();
|
const new_globals = new Set();
|
||||||
let old_globals = {};
|
let old_globals = {};
|
||||||
|
@ -18,7 +18,7 @@ const used_module_mocks = new Set();
|
||||||
const used_templates = new Set();
|
const used_templates = new Set();
|
||||||
|
|
||||||
const jquery_path = require.resolve("jquery");
|
const jquery_path = require.resolve("jquery");
|
||||||
const real_jquery_path = require.resolve("./real_jquery.js");
|
const real_jquery_path = require.resolve("./real_jquery.cjs");
|
||||||
|
|
||||||
let in_mid_render = false;
|
let in_mid_render = false;
|
||||||
let jquery_function;
|
let jquery_function;
|
|
@ -1,10 +1,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const namespace = require("./namespace.js");
|
const namespace = require("./namespace.cjs");
|
||||||
const zblueslip = require("./zblueslip.js");
|
const zblueslip = require("./zblueslip.cjs");
|
||||||
const $ = require("./zjquery.js");
|
const $ = require("./zjquery.cjs");
|
||||||
const zpage_billing_params = require("./zpage_billing_params.js");
|
const zpage_billing_params = require("./zpage_billing_params.cjs");
|
||||||
const zpage_params = require("./zpage_params.js");
|
const zpage_params = require("./zpage_params.cjs");
|
||||||
|
|
||||||
let current_file_name;
|
let current_file_name;
|
||||||
let verbose = false;
|
let verbose = false;
|
|
@ -8,8 +8,8 @@ const assert = require("node:assert/strict");
|
||||||
and then subsequent calls to $("#foo") get the
|
and then subsequent calls to $("#foo") get the
|
||||||
same instance.
|
same instance.
|
||||||
*/
|
*/
|
||||||
const FakeElement = require("./zjquery_element.js");
|
const FakeElement = require("./zjquery_element.cjs");
|
||||||
const FakeEvent = require("./zjquery_event.js");
|
const FakeEvent = require("./zjquery_event.cjs");
|
||||||
|
|
||||||
function verify_selector_for_zulip(selector) {
|
function verify_selector_for_zulip(selector) {
|
||||||
const is_valid =
|
const is_valid =
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const FakeEvent = require("./zjquery_event.js");
|
const FakeEvent = require("./zjquery_event.cjs");
|
||||||
|
|
||||||
const noop = function () {};
|
const noop = function () {};
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
|
|
||||||
const linkifiers = zrequire("linkifiers");
|
const linkifiers = zrequire("linkifiers");
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
const {ListCursor} = zrequire("list_cursor");
|
const {ListCursor} = zrequire("list_cursor");
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, mock_jquery, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, mock_jquery, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
// We need these stubs to get by instanceof checks.
|
// We need these stubs to get by instanceof checks.
|
||||||
// The ListWidget library allows you to insert objects
|
// The ListWidget library allows you to insert objects
|
|
@ -6,10 +6,10 @@ const katex = require("katex");
|
||||||
|
|
||||||
const markdown_test_cases = require("../../zerver/tests/fixtures/markdown_test_cases.json");
|
const markdown_test_cases = require("../../zerver/tests/fixtures/markdown_test_cases.json");
|
||||||
|
|
||||||
const markdown_assert = require("./lib/markdown_assert.js");
|
const markdown_assert = require("./lib/markdown_assert.cjs");
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
const example_realm_linkifiers = [
|
const example_realm_linkifiers = [
|
||||||
{
|
{
|
|
@ -4,8 +4,8 @@ const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const url_template_lib = require("url-template");
|
const url_template_lib = require("url-template");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const markdown = zrequire("markdown");
|
const markdown = zrequire("markdown");
|
||||||
const linkifiers = zrequire("linkifiers");
|
const linkifiers = zrequire("linkifiers");
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const message_edit = zrequire("message_edit");
|
const message_edit = zrequire("message_edit");
|
||||||
const people = zrequire("people");
|
const people = zrequire("people");
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
const message_edit = mock_esm("../src/message_edit");
|
const message_edit = mock_esm("../src/message_edit");
|
||||||
const message_lists = mock_esm("../src/message_lists");
|
const message_lists = mock_esm("../src/message_lists");
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const channel = mock_esm("../src/channel");
|
const channel = mock_esm("../src/channel");
|
||||||
const message_live_update = mock_esm("../src/message_live_update");
|
const message_live_update = mock_esm("../src/message_live_update");
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {make_stub} = require("./lib/stub.js");
|
const {make_stub} = require("./lib/stub.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
// These unit tests for web/src/message_list.ts emphasize the model-ish
|
// These unit tests for web/src/message_list.ts emphasize the model-ish
|
||||||
// aspects of the MessageList class. We have to stub out a few functions
|
// aspects of the MessageList class. We have to stub out a few functions
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
|
|
||||||
const user_topics = zrequire("user_topics");
|
const user_topics = zrequire("user_topics");
|
||||||
const muted_users = zrequire("muted_users");
|
const muted_users = zrequire("muted_users");
|
|
@ -4,9 +4,9 @@ const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const _ = require("lodash");
|
const _ = require("lodash");
|
||||||
|
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
|
|
||||||
set_global("document", "document-stub");
|
set_global("document", "document-stub");
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test, noop} = require("./lib/test.js");
|
const {run_test, noop} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
|
|
||||||
mock_esm("../src/settings_data", {
|
mock_esm("../src/settings_data", {
|
||||||
user_can_access_all_other_users: () => true,
|
user_can_access_all_other_users: () => true,
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
const hash_util = zrequire("hash_util");
|
const hash_util = zrequire("hash_util");
|
||||||
const compose_state = zrequire("compose_state");
|
const compose_state = zrequire("compose_state");
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const muted_users = zrequire("muted_users");
|
const muted_users = zrequire("muted_users");
|
||||||
const {initialize_user_settings} = zrequire("user_settings");
|
const {initialize_user_settings} = zrequire("user_settings");
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const all_messages_data = zrequire("../src/all_messages_data");
|
const all_messages_data = zrequire("../src/all_messages_data");
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
const people = zrequire("people");
|
const people = zrequire("people");
|
||||||
const {Filter} = zrequire("../src/filter");
|
const {Filter} = zrequire("../src/filter");
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const blueslip = require("./lib/zblueslip.js");
|
const blueslip = require("./lib/zblueslip.cjs");
|
||||||
|
|
||||||
mock_esm("../src/user_topics", {
|
mock_esm("../src/user_topics", {
|
||||||
is_topic_muted: () => false,
|
is_topic_muted: () => false,
|
|
@ -4,9 +4,9 @@ const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {addDays} = require("date-fns");
|
const {addDays} = require("date-fns");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
page_params.is_spectator = false;
|
page_params.is_spectator = false;
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
const $ = require("./lib/zjquery.js");
|
const $ = require("./lib/zjquery.cjs");
|
||||||
const {page_params} = require("./lib/zpage_params.js");
|
const {page_params} = require("./lib/zpage_params.cjs");
|
||||||
|
|
||||||
mock_esm("../src/electron_bridge");
|
mock_esm("../src/electron_bridge");
|
||||||
mock_esm("../src/spoilers", {hide_spoilers_in_notification() {}});
|
mock_esm("../src/spoilers", {hide_spoilers_in_notification() {}});
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
const assert = require("node:assert/strict");
|
const assert = require("node:assert/strict");
|
||||||
|
|
||||||
const {zrequire} = require("./lib/namespace.js");
|
const {zrequire} = require("./lib/namespace.cjs");
|
||||||
const {run_test} = require("./lib/test.js");
|
const {run_test} = require("./lib/test.cjs");
|
||||||
|
|
||||||
const {password_quality, password_warning} = zrequire("password_quality");
|
const {password_quality, password_warning} = zrequire("password_quality");
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue