Commit Graph

4788 Commits

Author SHA1 Message Date
Steve Howell
0014bc1549 node tests: Add test() wrapper for channel. 2021-03-20 11:00:48 -04:00
Steve Howell
8f9126cd91 node tests: Add huddle_string test. 2021-03-19 13:24:55 -04:00
Anders Kaseorg
0d218a4b76 eslint: Enable @typescript-eslint/consistent-type-imports.
TypeScript type-only imports will probably become important eventually
for reducing our circular import problem.

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-18 17:26:19 -07:00
Abhijeet Prasad Bodas
91234b2a86 node tests: Add tests for starred_messages.js. 2021-03-18 15:55:39 -07:00
Abhijeet Prasad Bodas
206fe1ef3b node tests: Introduce message_store.create_mock_message() helper.
Previously, it was tedious to create actual message
objects in message_store for use in node tests.
This was mainly because, `add_message_metadata`
in message_store has many dependencies and
validation checks. Since it was difficult to create
actual message objects, many tests just mocked
the `message_store.get()` method to return the desired
message.

This commit adds a new helper method (`create_mock_message`)
to message_store, for use in node tests. This just stores
the object passed to it in the `stores_messages` map,
without any validation. We do not add any
default fields to the message object before saving
it from this helper, because doing so would decrease
the utility of this helper, and, if a test
depends on some field having a particular value,
then it would be better to just pass the field: value
pair from the test itself, for readability, rather
than relying on the helper to add the field for us.

This helper allows us to write deeper tests.

This commit also replaces some instances of mocking
`message_store.get()` to use this new helper method.
2021-03-18 15:55:39 -07:00
Steve Howell
728905d4bc node tests: Clean pm_conversations more simply. 2021-03-18 16:37:20 -04:00
Steve Howell
b2be16c4d0 node tests: Use clean BuddyList instance in tests.
As part of this, we inline one function call rather
than changing it to have buddy_list be passed in.
2021-03-18 16:37:20 -04:00
YashRE42
2b03a74d97 channel: Add while_reloading test cases for 100% coverage.
The branches that depended on reload_state were introduced after a
refactor in 'presence' and never had relevant test cases added.
2021-03-18 10:09:22 -07:00
Anders Kaseorg
3ef6f6e2e2 js: Convert static/js/blueslip.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-17 08:47:15 -04:00
Anders Kaseorg
b0ceaa1ea0 node_tests: Replace override(blueslip) with blueslip.expect.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-17 08:47:15 -04:00
100RABHpy
039dd256a1 markdown: Fix a bug in query_and_reply.
Fixes #17466
This commit will change encoding logic. Initial logic
was not encoding parenthesis, and this creates conflicts
with the markdown link format. To resolve this while encoding,
we're now replacing parenthesis with ".28" and ".29."

There is no need to change decoding logic because before
decoding any URL, we first convert all the “.” to “%.”

optimization: No need to replace parenthesis in popovers.js.
2021-03-16 16:40:37 -07:00
Steve Howell
5192dab31d node tests: Add explicit stub_templates calls. 2021-03-16 14:53:52 -04:00
Steve Howell
93ba7c7c02 node tests: Isolate message mutations for recent_topics. 2021-03-16 14:53:52 -04:00
Steve Howell
2a80c23484 node tests: Add test wrapper to recent_topics. 2021-03-16 14:53:52 -04:00
Steve Howell
c05007b427 node tests: Use more overrides in composebox_typeahead. 2021-03-16 14:53:52 -04:00
Steve Howell
15d99f87fb node tests: Clear more data for typeahead_helper.
We also use a more realistic method of setting
recipient counts, and we make the pm count test
a bit more explicit.
2021-03-16 09:04:26 -04:00
Steve Howell
0523f96a1b node tests: Add test() wrapper for markdown tests. 2021-03-16 09:04:26 -04:00
Steve Howell
4d59fb1063 node tests: Set compose state for compose_actions tests. 2021-03-16 09:04:26 -04:00
Steve Howell
157ab156e7 node tests: Use override for current_msg_list. 2021-03-16 09:04:26 -04:00
Steve Howell
433d42e723 node tests: Add whiny_get() helper. 2021-03-16 09:04:26 -04:00
Steve Howell
764b83b890 node tests: Remove stub_channel_get().
A few years ago I introduced the anti-pattern
of automatically calling success functions within
channel.get stubs.  It's better to just capture
the success function and call it explicitly.

Also, we now have override(), so it's easy to
inline these types of things in a safe way.
2021-03-16 09:04:26 -04:00
Steve Howell
6b0ceeb3b0 node tests: Remove stub_selected_message. 2021-03-16 09:04:26 -04:00
Steve Howell
c06dedf670 node tests: Add test() wrapper for filter tests. 2021-03-16 09:04:26 -04:00
Steve Howell
4f2170994a node tests: Move functions higher up in file. 2021-03-16 09:04:26 -04:00
Steve Howell
e9e8bcd26e node tests: Add popovers.clear_for_testing(). 2021-03-16 09:04:26 -04:00
Steve Howell
9c9d381890 node tests: Add test() for composebox_typeahead. 2021-03-16 09:04:26 -04:00
Steve Howell
2093bc96f4 node tests: Extract get_results() helper. 2021-03-16 09:04:26 -04:00
Abhijeet Prasad Bodas
9223dced3b refactor: Rename filter to linkifier in frontend code and docs.
This only leaves `page_params.realm_filters`, which
will be changed in further commits along with the
API change.
2021-03-15 11:19:59 -07:00
Steve Howell
9a6cb441e1 node tests: Remove misleading subscribed fields.
The stream_data.create_streams() helper ignores
these booleans, so they are just confusing for
debugging purposes.
2021-03-15 13:05:49 -04:00
Steve Howell
0dc597bceb node tests: Move data setup higher in the file. 2021-03-15 13:05:49 -04:00
Steve Howell
ece986bd10 node tests: Clear data for sort_recipients. 2021-03-15 13:05:49 -04:00
Steve Howell
af292d550f node tests: Clean up render tests for typeahead_helper. 2021-03-15 13:05:49 -04:00
Steve Howell
3b75674b08 node tests: Localize all_obj consts. 2021-03-15 13:05:49 -04:00
Steve Howell
d7d357f61e node tests: Add test_all() wrapper for widgetize.
I also move around a couple set_global/mock_esm
calls.
2021-03-15 13:05:49 -04:00
Steve Howell
09bad82131 node tests: Add test() wrapper for typing_data. 2021-03-15 13:05:49 -04:00
Steve Howell
deaf633b04 node tests: Call initialize_state() earlier.
This makes the test re-runnable.
2021-03-15 13:05:49 -04:00
Steve Howell
198c67a9bd node tests: Split up tutorial into smaller examples.
I didn't bother to keep the very last test from
tutorial, which has some complications related
to clearing stream_list data and was kind of
overkill.
2021-03-15 10:46:00 -04:00
Nikhil Maske
f5544e36ed markdown: Add fa-clock icon before markdown timestamps.
These sigils will help make it easier to see that this is a special
Zulip syntax feature, not just something the other user typed, which
might help set the expectation that we're showing the time in the
user's timezone.

Tweaked by tabbott to improve variable/template naming.
2021-03-14 22:57:01 -07:00
Steve Howell
bbe12a3967 node tests: Ensure clean data for timerender tests.
We explicitly initialize things that future tests
could possibly mutate.
2021-03-14 11:38:21 -04:00
Steve Howell
7bb861303a node tests: Add test() wrapper to compose_actions.
I also do s/Bob/Steve/ in a test to avoid any
confusion about intra-test leaks.

In passing I clean up the dubious reply_to
fields.
2021-03-14 11:38:21 -04:00
Steve Howell
9db20afd19 node tests: Clean up stream_events.
* hoist dev_help
* extract narrow_to_frontend()
* use more explicit setup
* add test() wrapper
2021-03-14 10:46:45 -04:00
Steve Howell
ce9c31ca6b node tests: Clean up settings_org.
I add a test() wrapper and use override()
more liberally.
2021-03-14 10:46:45 -04:00
Steve Howell
f9101c91b5 node tests: Remove needless reset test.
We want to reset in the main test here to ensure
a clean slate, and doing so makes the other
test redundant.
2021-03-14 10:46:45 -04:00
Steve Howell
92e611a787 node tests: Add test() wrapper for lightbox. 2021-03-14 10:46:45 -04:00
Steve Howell
63a0f6b352 node tests: Extract override_random_id. 2021-03-14 08:11:25 -04:00
Steve Howell
ae6c435bb4 node tests: Clean up hashchange tests.
* use override
* localize window_stub
* add clear_for_testing() helper
2021-03-14 08:11:25 -04:00
Steve Howell
45c433b346 node tests: Clean up drafts tests.
I add a test() wrapper and clean up some
of the date-related code.
2021-03-14 08:11:25 -04:00
Steve Howell
569a68a057 node tests: Clean up buddy_data tests.
We mostly add the test() wrapper to give
each test a clean slate.
2021-03-14 08:11:25 -04:00
Steve Howell
85bd196bfc node tests: Add test() wrapper to bot_data. 2021-03-14 08:11:25 -04:00
Steve Howell
612f79ea6f node tests: Add env var to components test.
This makes it easier to run the test multiple
times.
2021-03-14 08:11:25 -04:00