Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
node tests: Clean pm_conversations more simply.
Steve Howell728905d4bcff
diff --git a/frontend_tests/node_tests/pm_conversations.js b/frontend_tests/node_tests/pm_conversations.jsindex 6f469368fc5..f094d871ee9 100644--- a/frontend_tests/node_tests/pm_conversations.js+++ b/frontend_tests/node_tests/pm_conversations.js@@ -9,7 +9,7 @@ const people = zrequire("people");const pmc = zrequire("pm_conversations");function initialize_recents(params) {- pmc.recent.clear_for_testing();+ pmc.clear_for_testing();pmc.recent.initialize(params);}diff --git a/frontend_tests/node_tests/pm_list.js b/frontend_tests/node_tests/pm_list.jsindex 122b67d7c3e..6b3d459e8dd 100644--- a/frontend_tests/node_tests/pm_list.js+++ b/frontend_tests/node_tests/pm_list.js@@ -56,7 +56,7 @@ people.initialize_current_user(me.user_id);function test(label, f) {run_test(label, (override) => {- pm_conversations.recent.clear_for_testing();+ pm_conversations.clear_for_testing();pm_list.clear_for_testing();f(override);});diff --git a/static/js/pm_conversations.js b/static/js/pm_conversations.jsindex 03e74503778..d90e1a29f29 100644--- a/static/js/pm_conversations.js+++ b/static/js/pm_conversations.js@@ -18,12 +18,6 @@ class RecentPrivateMessages {recent_message_ids = new FoldDict(); // key is user_ids_stringrecent_private_messages = [];- clear_for_testing() {- // Because we only export the singleton, we need this for tests.- this.recent_message_ids.clear();- this.recent_private_messages.length = 0;- }-insert(user_ids, message_id) {if (user_ids.length === 0) {// The server sends [] for self-PMs.@@ -81,9 +75,9 @@ class RecentPrivateMessages {}}-export const recent = new RecentPrivateMessages();+export let recent = new RecentPrivateMessages();export function clear_for_testing() {- recent.clear_for_testing();+ recent = new RecentPrivateMessages();partners.clear();}