node tests: Add huddle_string test.

This commit is contained in:
Steve Howell 2021-03-19 12:48:16 +00:00 committed by Steve Howell
parent 0d218a4b76
commit 8f9126cd91
1 changed files with 18 additions and 0 deletions

View File

@ -1089,5 +1089,23 @@ test_people("get_active_message_people", () => {
assert.deepEqual(active_message_people, [steven, maria]);
});
test_people("huddle_string", () => {
assert.equal(people.huddle_string({type: "stream"}), undefined);
function huddle(user_ids) {
return people.huddle_string({
type: "private",
display_recipient: user_ids.map((id) => ({id})),
});
}
people.add_active_user(maria);
people.add_active_user(bob);
assert.equal(huddle([]), undefined);
assert.equal(huddle([me.user_id, maria.user_id]), undefined);
assert.equal(huddle([me.user_id, maria.user_id, bob.user_id]), "203,302");
});
// reset to native Date()
MockDate.reset();