Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

node tests: Clear data for sort_recipients.

Steve Howellece986bd10b0
diff --git a/frontend_tests/node_tests/typeahead_helper.js b/frontend_tests/node_tests/typeahead_helper.js
index eec2f1d5112..f86054d2061 100644
--- a/frontend_tests/node_tests/typeahead_helper.js
+++ b/frontend_tests/node_tests/typeahead_helper.js
@@ -299,6 +299,19 @@ function get_typeahead_result(query, current_stream, current_topic) {
}
run_test("sort_recipients", () => {
+ pm_conversations.clear_for_testing();
+ recent_senders.clear_for_testing();
+ peer_data.clear_for_testing();
+ a_bot.pm_recipient_count = 0;
+ a_user.pm_recipient_count = 0;
+ b_user_1.pm_recipient_count = 0;
+ b_user_2.pm_recipient_count = 0;
+ b_user_3.pm_recipient_count = 0;
+ b_bot.pm_recipient_count = 0;
+
+ const dev_sub = stream_data.get_sub("Dev");
+ const linux_sub = stream_data.get_sub("Linux");
+
// Typeahead for recipientbox [query, "", undefined]
assert.deepEqual(get_typeahead_result("b", ""), [
@@ -328,8 +341,6 @@ run_test("sort_recipients", () => {
peer_data.add_subscriber(1, people.get_user_id(subscriber_email_2));
peer_data.add_subscriber(1, people.get_user_id(subscriber_email_3));
- const dev_sub = stream_data.get_sub("Dev");
- const linux_sub = stream_data.get_sub("Linux");
stream_data.update_calculated_fields(dev_sub);
stream_data.update_calculated_fields(linux_sub);
diff --git a/static/js/pm_conversations.js b/static/js/pm_conversations.js
index ccf99ee3d46..03e74503778 100644
--- a/static/js/pm_conversations.js
+++ b/static/js/pm_conversations.js
@@ -82,3 +82,8 @@ class RecentPrivateMessages {
}
export const recent = new RecentPrivateMessages();
+
+export function clear_for_testing() {
+ recent.clear_for_testing();
+ partners.clear();
+}