mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
node tests: Clean pm_conversations more simply.
This commit is contained in:
committed by
Steve Howell
parent
b2be16c4d0
commit
728905d4bc
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -18,12 +18,6 @@ class RecentPrivateMessages {
|
||||
recent_message_ids = new FoldDict(); // key is user_ids_string
|
||||
recent_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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user