snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
88
web/tests/direct_message_group_data.test.cjs
Normal file
88
web/tests/direct_message_group_data.test.cjs
Normal file
@@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {make_user} = require("./lib/example_user.cjs");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const direct_message_group_data = zrequire("direct_message_group_data");
|
||||
const people = zrequire("people");
|
||||
|
||||
function create_user(info) {
|
||||
const user = make_user(info);
|
||||
people.add_active_user(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
const me = create_user({
|
||||
email: "me@zulip.com",
|
||||
user_id: 999,
|
||||
full_name: "Me Myself",
|
||||
});
|
||||
|
||||
const alice = create_user({
|
||||
email: "alice@zulip.com",
|
||||
user_id: 1,
|
||||
full_name: "Alice Smith",
|
||||
});
|
||||
|
||||
const fred = create_user({
|
||||
email: "fred@zulip.com",
|
||||
user_id: 2,
|
||||
full_name: "Fred Flintstone",
|
||||
});
|
||||
|
||||
const jill = create_user({
|
||||
email: "jill@zulip.com",
|
||||
user_id: 3,
|
||||
full_name: "Jill Hill",
|
||||
});
|
||||
|
||||
const norbert = create_user({
|
||||
email: "norbert@zulip.com",
|
||||
user_id: 5,
|
||||
full_name: "Norbert Oswald",
|
||||
});
|
||||
|
||||
people.initialize_current_user(me.user_id);
|
||||
|
||||
run_test("direct_message_group_data.process_loaded_messages", () => {
|
||||
const timestamp1 = 1382479029; // older
|
||||
const timestamp2 = 1382479033; // newer
|
||||
|
||||
const old_timestamp = 1382479000;
|
||||
|
||||
const messages = [
|
||||
{
|
||||
type: "private",
|
||||
display_recipient: [{id: jill.user_id}, {id: norbert.user_id}],
|
||||
timestamp: timestamp1,
|
||||
},
|
||||
{
|
||||
type: "stream",
|
||||
},
|
||||
// direct message to myself
|
||||
{
|
||||
type: "private",
|
||||
display_recipient: [{id: me.user_id}],
|
||||
},
|
||||
{
|
||||
type: "private",
|
||||
display_recipient: [{id: alice.user_id}, {id: fred.user_id}],
|
||||
timestamp: timestamp2,
|
||||
},
|
||||
{
|
||||
type: "private",
|
||||
display_recipient: [{id: fred.user_id}, {id: alice.user_id}],
|
||||
timestamp: old_timestamp,
|
||||
},
|
||||
];
|
||||
|
||||
direct_message_group_data.process_loaded_messages(messages);
|
||||
|
||||
assert.deepEqual(direct_message_group_data.get_direct_message_groups(), [
|
||||
`${alice.user_id},${fred.user_id}`,
|
||||
`${jill.user_id},${norbert.user_id}`,
|
||||
]);
|
||||
});
|
||||
Reference in New Issue
Block a user