Commit Graph

3241 Commits

Author SHA1 Message Date
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
Steve Howell c0f2315dd5 node tests: Avoid __Rewire__ in stream_list. 2021-03-13 14:47:49 -05:00
Steve Howell 5f6b0bc831 node tests: Avoid __Rewire__ in stream_edit. 2021-03-13 14:47:49 -05:00
Steve Howell b1d59237b9 node tests: Avoid __Rewire__ call in drafts.. 2021-03-13 14:47:49 -05:00
Steve Howell 4b62f8c90f node tests: Avoid __Rewire__ in compose_actions. 2021-03-13 14:47:49 -05:00
Steve Howell 9c3f526fae node tests: Explicitly set hash for billing test. 2021-03-13 11:48:50 -05:00
Steve Howell fbd3669461 zjsunit: Do not run $(...) automatically.
We have generally gone away from using $(...)
initialization in modules that we test with
zjsunit, but there are a few remaining special
cases related to our billing and portico
codebases.
2021-03-13 11:48:50 -05:00
Steve Howell bc8647539c code cleanup: Remove obsolete stream_sort code.
I remove an obsolete comment--we use get_streams()
for the `n` key now.

I also remove a guard statement from sort_groups()
that returned `undefined` for empty lists.

That guard statement would break this code:

    const stream_groups = stream_sort.sort_groups(streams, get_search_term());

    if (stream_groups.same_as_before && ...

The calling code prevents the situation anyway:

    const streams = stream_data.subscribed_stream_ids();
    if (streams.length === 0) {
        return;
    }

I modify the "no_subscribed_streams" test to test
the new behavior.  (Even though stream_list currently
short-circuits the call here, that may change in the future.)

I also introduce the test() wrapper to explicitly clear
our data.
2021-03-13 11:48:50 -05:00
Steve Howell 9c4d7b3bd4 node tests: Add test() wrapper for stream_topic_history. 2021-03-13 11:48:50 -05:00
Steve Howell bfb06c939c node tests: Add test() wrapper for topic_list_data. 2021-03-12 17:52:04 -05:00
Steve Howell a0534b5b03 node tests: Clean up all_topics_in_cache test.
We use override() and clear the message data
explicitly.
2021-03-12 15:29:23 -05:00
Steve Howell 88357579fe node tests: Add test() wrapper for stream_data. 2021-03-12 15:29:23 -05:00
Steve Howell 154daf353b node tests: Add test() wrapper for suggestions. 2021-03-12 15:29:23 -05:00
Steve Howell 9c1e21689b node tests: Use override in search_suggestion. 2021-03-12 15:29:23 -05:00
Anders Kaseorg ea9ca6b7d0 js: Use jQuery as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-12 10:08:25 -08:00
Anders Kaseorg ac36d59728 node_tests: Move set_global mock in components before zrequire call.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-12 10:06:34 -08:00
Anders Kaseorg 92a46888f0 node_tests: Mock sortablejs to avoid __Rewire__.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-12 10:06:34 -08:00
Anders Kaseorg 5fc8a12d7b node_tests: Mock clipboard to avoid __Rewire__.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-12 10:06:34 -08:00
Anders Kaseorg 7529491c67 node_tests: Mock @uppy/core to avoid __Rewire__.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-12 10:06:34 -08:00
Anders Kaseorg 876806eb4d zjsunit: Lift restriction against mocking third party modules.
Use fully resolvable request paths because we need to be able to refer
to third party modules, and to increase uniformity and explicitness.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-12 10:06:30 -08:00
Steve Howell 87a3650176 node tests: Clean up recent_senders test.
This introduces the make_stream_message()
helper to avoid all the strange
`messages[0] === message1` confusion.

We also clear data explicitly at the beginning
of the test.

It's still a messy test.
2021-03-12 11:18:44 -05:00
Steve Howell bae508d1c9 node tests: Explicitly set filters for markdown test. 2021-03-12 11:18:44 -05:00
Steve Howell d1d0742e0a node tests: Move test to fenced_code.js. 2021-03-12 11:18:44 -05:00
Steve Howell 6cb255b559 node tests: Use clean data in reaction tests.
A bunch of tests were mutating the same message.
Now they just make their own copy.

I introduce the name "sample_message" for the common
message, but I remove the two bogus reactions, and
the "warning" test now just creates its own
test-specific data.
2021-03-12 11:18:44 -05:00
Steve Howell f5506c78aa node tests: Clear data for presence tests.
I considered using set_info({}, 0) to clear data,
but it has a lot of machinery that could lead
to accidental line coverage and/or extra test
complexity.
2021-03-12 11:18:44 -05:00
Steve Howell bbf529f2a5 node tests: Clear data for pm_list tests. 2021-03-12 11:18:44 -05:00
Steve Howell 67a5fe95dc minor: Remove empty pm_list.initialize().
The commit 3cfc3ca24b
made this function do nothing, but I guess that
we thought we might resurrect the click handler
in the short term.  We never did.
2021-03-12 11:18:44 -05:00
m-e-l-u-h-a-n e781136acd css: Add separate class for typeahead items with no presence circle.
This commit adds a new class for typeahead items that do not need
a presence circle. It is changed to support addition of new items
that do not require presence circle.

There should not be any visual change due to this.
2021-03-12 02:10:21 -08:00
Steve Howell d1e0aa1aa5 node tests: Break up password tests.
This diff is slightly noisy due to hoisting
one helper, but it's hoisted verbatim.
2021-03-12 04:42:37 -05:00
Steve Howell a97cfd06c0 node tests: Clean up muting tests.
* move one test below setup
    * add a test() wrapper to clear mutes
    * split up a test
    * use two different dates for java vs. gossip
    * deterministically sort by date

All these changes make it so that the order of
the tests is a lot less fragile.
2021-03-12 04:42:37 -05:00
Steve Howell 950effbb57 node tests: Add overrides for message_flags. 2021-03-12 04:42:37 -05:00
Steve Howell 71ccb99531 node tests: Clean up pm_conversations.
* Hoist zrequire("people") to the top.
    * Add clear_for_testing() hook.
    * Add initialize_recents() helper.
2021-03-12 04:42:37 -05:00
Steve Howell 7f700b6f5a minor: Use override in people_errors. 2021-03-12 04:42:37 -05:00
Steve Howell 0c2aa1d3e8 node tests: Clean up electron-related code. 2021-03-12 04:42:37 -05:00
Steve Howell 26fed458e6 node tests: Clean up dispatch tests.
These are minor cleanups to make tests more
idempotent.
2021-03-12 04:42:37 -05:00