Files
upstream-zulip/web/tests/lib/example_stream.cjs
upstream-mirror 64898b2c79
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
snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
2026-09-15 15:05:30 +05:00

58 lines
2.0 KiB
JavaScript

"use strict";
let last_issued_stream_id = 20000;
const get_stream_id = () => {
last_issued_stream_id += 1 + Math.floor(Math.random() * 10);
return last_issued_stream_id;
};
exports.make_stream = (opts = {}) => {
// Since other fields are computed from these, we need to
// pull these out of opts early.
const stream_id = opts.stream_id ?? get_stream_id();
const name = opts.name ?? `stream-${stream_id}`;
const default_channel = {
audible_notifications: false,
/* BUG: This should always be a group ID. But it's annoying to
* fix without assuming groups exist in the data set. */
can_remove_subscribers_group: 0,
can_administer_channel_group: 2,
can_create_topic_group: 2,
color: "abcd12",
/* This is rarely going to be the case, but a valid possibility. */
creator_id: null,
date_created: Date.now(),
description: `Description of ${name}`,
desktop_notifications: false,
email_address: "channel-email-address@example.com",
email_notifications: false,
/* This will rarely be the case, but is a valid possibility*/
first_message_id: null,
history_public_to_subscribers: true,
invite_only: false,
is_announcement_only: false,
is_muted: false,
is_web_public: false,
message_retention_days: null,
name,
newly_subscribed: false,
pin_to_top: false,
previously_subscribed: false,
push_notifications: false,
rendered_description: `<p>Description of ${name}</p>`,
stream_id,
/* STREAM_POST_POLICY_EVERYONE */
stream_post_policy: 1,
stream_weekly_traffic: 0,
/* Most tests want to work with a channel the current user is subscribed to. */
subscribed: true,
topics_policy: "inherit",
wildcard_mentions_notify: false,
folder_id: null,
};
return {...default_channel, ...opts};
};