zulip/frontend_tests/node_tests
Steve Howell 45d806d9aa refactor: Extract message_helper.process_new_message.
We move the message_store.add_message_metadata function
(and all its dependencies) into a new module called
message_helper and rename the function to process_new_message.
(It does a bit more than adding message metadata, such
as updating our message store.)

We also have a "protected" interface now in message_store,
so that message_helper can access the message store:

    update_message_cache
    get_cached_message

Because update_message_cache is identical to
the former create_mock_message, we just renamed it
in the tests.

Most callers should use these functions:

    message_helper.process_new_message (setting)
    message_store.get (getting)

It's slightly annoying that the setter interface
is in a different module than the getter interface,
but that's how you break a bunch of dependencies.

We also extract the tiny message_user_ids class:

    user_ids()
    add_user_ids()

All the code moves here are pretty trivial, and
the code that was moved maintains 100% line
coverage.

The module name `message_helper` is not ideal, but it's a single
function and it'll save time to just do the topology change now and
leave thinking through the right name to later.
2021-03-29 14:53:57 -07:00
..
lib user groups: Add remove event. 2021-03-28 16:18:09 -07:00
templates template.js: Add test for "numberFormat" helper. 2021-03-23 10:46:04 -07:00
activity.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
alert_words.js node tests: Avoid intra-test leaks for alert_words. 2021-03-08 10:45:17 -05:00
alert_words_ui.js js: Convert static/js/i18n.js to ES6 module. 2021-03-26 10:17:56 -07:00
billing.js zjsunit: Do not run $(...) automatically. 2021-03-13 11:48:50 -05:00
billing_helpers.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
blueslip_stacktrace.js zjsunit: Deglobalize run_test. 2020-12-01 07:14:00 -05:00
bot_data.js bots: Lift render_bots calls to dispatcher code. 2021-03-22 19:40:06 -07:00
browser_history.js refactor: Extract browser_history module. 2021-03-22 13:29:32 -07:00
buddy_data.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
buddy_list.js node tests: Use clean BuddyList instance in tests. 2021-03-18 16:37:20 -04:00
channel.js node tests: Add test() wrapper for channel. 2021-03-20 11:00:48 -04:00
color_data.js js: Convert static/js/color_data.js to ES6 module. 2021-02-28 14:23:00 -08:00
colorspace.js node_tests: Don’t read from most deprecated global variables. 2021-02-10 07:40:22 -08:00
common.js zjsunit: Do not run $(...) automatically. 2021-03-13 11:48:50 -05:00
components.js js: Convert static/js/i18n.js to ES6 module. 2021-03-26 10:17:56 -07:00
compose.js refactor: Move insert_message to echo. 2021-03-28 15:55:55 -07:00
compose_actions.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
compose_fade.js compose fade: Extract compose_fade_users class. 2021-03-21 20:16:08 -07:00
compose_pm_pill.js js: Use jQuery as a module. 2021-03-12 10:08:25 -08:00
compose_state.js zjsunit: Lift restriction against mocking third party modules. 2021-03-12 10:06:30 -08:00
compose_ui.js js: Convert static/js/i18n.js to ES6 module. 2021-03-26 10:17:56 -07:00
compose_video.js js: Convert static/js/csrf.js to ES6 module. 2021-03-26 10:17:56 -07:00
composebox_typeahead.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
copy_and_paste.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
dispatch.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
dispatch_subs.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
drafts.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
dropdown_list_widget.js js: Convert static/js/i18n.js to ES6 module. 2021-03-26 10:17:56 -07:00
echo.js refactor: Move insert_message to echo. 2021-03-28 15:55:55 -07:00
emoji.js zjsunit: Remove rewiremock dependency. 2021-03-06 11:10:57 -05:00
emoji_picker.js zjsunit: Remove rewiremock dependency. 2021-03-06 11:10:57 -05:00
example1.js node tests: Split up tutorial into smaller examples. 2021-03-15 10:46:00 -04:00
example2.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
example3.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
example4.js node tests: Split up tutorial into smaller examples. 2021-03-15 10:46:00 -04:00
example5.js node tests: Split up tutorial into smaller examples. 2021-03-15 10:46:00 -04:00
example6.js node tests: Split up tutorial into smaller examples. 2021-03-15 10:46:00 -04:00
example7.js node tests: Split up tutorial into smaller examples. 2021-03-15 10:46:00 -04:00
fenced_code.js node tests: Move test to fenced_code.js. 2021-03-12 11:18:44 -05:00
fetch_status.js zjsunit: Lift restriction against mocking third party modules. 2021-03-12 10:06:30 -08:00
filter.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
fold_dict.js zjsunit: Deglobalize run_test. 2020-12-01 07:14:00 -05:00
hash_util.js js: Use jQuery as a module. 2021-03-12 10:08:25 -08:00
hashchange.js refactor: Extract browser_history module. 2021-03-22 13:29:32 -07:00
hotkey.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
i18n.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
input_pill.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
keydown_util.js zjquery: Make zjquery a singleton. 2021-02-21 17:34:55 -05:00
lazy_set.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
lightbox.js node tests: Add test() wrapper for lightbox. 2021-03-14 10:46:45 -04:00
list_cursor.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
list_widget.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
markdown.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
markdown_katex.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
message_edit.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
message_events.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
message_fetch.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
message_flags.js zjsunit: Lift restriction against mocking third party modules. 2021-03-12 10:06:30 -08:00
message_list.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
message_list_data.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
message_list_view.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
message_store.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
muting.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
narrow.js refactor: Extract narrow_banner module. 2021-03-28 15:55:55 -07:00
narrow_activate.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
narrow_local.js zjsunit: Lift restriction against mocking third party modules. 2021-03-12 10:06:30 -08:00
narrow_state.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
narrow_unread.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
notifications.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
password.js node tests: Break up password tests. 2021-03-12 04:42:37 -05:00
peer_data.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
people.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
people_errors.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
pm_conversations.js node tests: Clean pm_conversations more simply. 2021-03-18 16:37:20 -04:00
pm_list.js node tests: Clean pm_conversations more simply. 2021-03-18 16:37:20 -04:00
poll_widget.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
popovers.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
presence.js refactor: Move suspect_offline logic into watchdog. 2021-03-23 14:08:39 -04:00
reactions.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
recent_senders.js zjsunit: Lift restriction against mocking third party modules. 2021-03-12 10:06:30 -08:00
recent_topics.js eslint: Enable spaced-comment rule. 2021-03-26 16:32:25 -07:00
reload_state.js node tests: Add test() wrapper for reload_state. 2021-03-22 15:11:28 -04:00
rendered_markdown.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
rtl.js node tests: Directly test how we add/remove rtl class. 2021-03-05 12:57:20 -05:00
schema.js node_tests: Don’t read from most deprecated global variables. 2021-02-10 07:40:22 -08:00
scroll_util.js zjsunit: Lift restriction against mocking third party modules. 2021-03-12 10:06:30 -08:00
search.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
search_legacy.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
search_pill.js node tests: Eliminate many __Rewire__ calls. 2021-03-07 11:19:33 -05:00
search_suggestion.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
search_suggestion_legacy.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
server_events.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
settings_bots.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
settings_config.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
settings_data.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
settings_emoji.js js: Use jQuery as a module. 2021-03-12 10:08:25 -08:00
settings_muting.js node tests: Remove needless reset test. 2021-03-14 10:46:45 -04:00
settings_org.js js: Convert static/js/csrf.js to ES6 module. 2021-03-26 10:17:56 -07:00
settings_profile_fields.js custom profile fields: Rename "CHOICE" to "SELECT" in frontend. 2021-03-26 11:49:11 -07:00
settings_user_groups.js user groups: Add remove event. 2021-03-28 16:18:09 -07:00
spoilers.js js: Use jQuery as a module. 2021-03-12 10:08:25 -08:00
starred_messages.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
stream_data.js refactor: Break stream_data's dep on stream_color. 2021-03-28 15:55:55 -07:00
stream_edit.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
stream_events.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
stream_list.js eslint: Enable spaced-comment rule. 2021-03-26 16:32:25 -07:00
stream_pill.js node_tests: Don’t read from most deprecated global variables. 2021-02-10 07:40:22 -08:00
stream_search.js js: Use jQuery as a module. 2021-03-12 10:08:25 -08:00
stream_sort.js code cleanup: Remove obsolete stream_sort code. 2021-03-13 11:48:50 -05:00
stream_topic_history.js node tests: Add test() wrapper for stream_topic_history. 2021-03-13 11:48:50 -05:00
submessage.js zjsunit: Lift restriction against mocking third party modules. 2021-03-12 10:06:30 -08:00
subs.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
support.js zjsunit: Do not run $(...) automatically. 2021-03-13 11:48:50 -05:00
templates.js template.js: Add test for "numberFormat" helper. 2021-03-23 10:46:04 -07:00
timerender.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
top_left_corner.js js: Use jQuery as a module. 2021-03-12 10:08:25 -08:00
topic_generator.js node tests: Eliminate many __Rewire__ calls. 2021-03-07 11:19:33 -05:00
topic_list_data.js node tests: Add test() wrapper for topic_list_data. 2021-03-12 17:52:04 -05:00
transmit.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
typeahead.js minor: Check if typeahead query exists. 2021-03-25 02:08:51 -07:00
typeahead_helper.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
typing_data.js node tests: Add test() wrapper for typing_data. 2021-03-15 13:05:49 -04:00
typing_status.js node tests: Call initialize_state() earlier. 2021-03-15 13:05:49 -04:00
ui.js node_tests: Consistently move set_global mocks before zrequire calls. 2021-02-26 07:55:53 -08:00
unread.js refactor: Extract message_helper.process_new_message. 2021-03-29 14:53:57 -07:00
upgrade.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
upload.js js: Convert static/js/csrf.js to ES6 module. 2021-03-26 10:17:56 -07:00
user_events.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
user_groups.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
user_pill.js js: Convert static/js/page_params.js to ES6 module. 2021-03-26 10:17:56 -07:00
user_status.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
util.js node tests: Clean up robust_uri_decode. 2021-03-12 04:42:37 -05:00
vdom.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
watchdog.js refactor: Move suspect_offline logic into watchdog. 2021-03-23 14:08:39 -04:00
widgetize.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
zblueslip.js js: Convert static/js/blueslip.js to ES6 module. 2021-03-17 08:47:15 -04:00
zjquery.js zjquery: Prohibit extensions to $.fn. 2021-02-22 10:04:29 -05:00