mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
node tests: Test direct mentions.
This never got tested despite 100% line coverage, due to a boolean expression.
This commit is contained in:
@@ -510,31 +510,49 @@ test("mentions", () => {
|
|||||||
unread: true,
|
unread: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const muted_direct_mention_message = {
|
||||||
|
id: 17,
|
||||||
|
type: "stream",
|
||||||
|
stream_id: muted_stream_id,
|
||||||
|
topic: "lunch",
|
||||||
|
mentioned: true,
|
||||||
|
mentioned_me_directly: true,
|
||||||
|
unread: true,
|
||||||
|
};
|
||||||
|
|
||||||
unread.process_loaded_messages([
|
unread.process_loaded_messages([
|
||||||
already_read_message,
|
already_read_message,
|
||||||
mention_me_message,
|
mention_me_message,
|
||||||
mention_all_message,
|
mention_all_message,
|
||||||
muted_mention_all_message,
|
muted_mention_all_message,
|
||||||
|
muted_direct_mention_message,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
counts = unread.get_counts();
|
counts = unread.get_counts();
|
||||||
assert.equal(counts.mentioned_message_count, 2);
|
assert.equal(counts.mentioned_message_count, 3);
|
||||||
assert.deepEqual(unread.get_msg_ids_for_mentions(), [
|
assert.deepEqual(unread.get_msg_ids_for_mentions(), [
|
||||||
mention_me_message.id,
|
mention_me_message.id,
|
||||||
mention_all_message.id,
|
mention_all_message.id,
|
||||||
|
muted_direct_mention_message.id,
|
||||||
]);
|
]);
|
||||||
assert.deepEqual(unread.get_all_msg_ids(), [
|
assert.deepEqual(unread.get_all_msg_ids(), [
|
||||||
mention_me_message.id,
|
mention_me_message.id,
|
||||||
mention_all_message.id,
|
mention_all_message.id,
|
||||||
muted_mention_all_message.id,
|
muted_mention_all_message.id,
|
||||||
]);
|
]);
|
||||||
test_notifiable_count(counts.home_unread_messages, 2);
|
test_notifiable_count(counts.home_unread_messages, 3);
|
||||||
|
|
||||||
unread.mark_as_read(mention_me_message.id);
|
unread.mark_as_read(mention_me_message.id);
|
||||||
unread.mark_as_read(mention_all_message.id);
|
unread.mark_as_read(mention_all_message.id);
|
||||||
|
unread.mark_as_read(muted_direct_mention_message.id);
|
||||||
counts = unread.get_counts();
|
counts = unread.get_counts();
|
||||||
assert.equal(counts.mentioned_message_count, 0);
|
assert.equal(counts.mentioned_message_count, 0);
|
||||||
test_notifiable_count(counts.home_unread_messages, 0);
|
test_notifiable_count(counts.home_unread_messages, 0);
|
||||||
|
|
||||||
|
// redundantly read a message to make sure nothing explodes
|
||||||
|
unread.mark_as_read(muted_direct_mention_message.id);
|
||||||
|
counts = unread.get_counts();
|
||||||
|
assert.equal(counts.mentioned_message_count, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("mention updates", () => {
|
test("mention updates", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user