Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

node fixtures: Add more realistic data for streams/subs.

Steve Howellb4a4f9d56803
diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js
index 0cc4c19c402..1d6ce1faf97 100644
--- a/frontend_tests/node_tests/dispatch.js
+++ b/frontend_tests/node_tests/dispatch.js
@@ -568,7 +568,7 @@ with_overrides((override) => {
const args = stub.get_args("streams");
assert_same(
args.streams.map((stream) => stream.stream_id),
- [42, 99],
+ [101, 102],
);
});
diff --git a/frontend_tests/node_tests/dispatch_subs.js b/frontend_tests/node_tests/dispatch_subs.js
index 669b196cf78..e9dd2e65b71 100644
--- a/frontend_tests/node_tests/dispatch_subs.js
+++ b/frontend_tests/node_tests/dispatch_subs.js
@@ -103,7 +103,7 @@ test("add error handling", (override) => {
global.with_stub((stub) => {
override("blueslip.error", stub.f);
dispatch(event);
- assert.deepEqual(stub.get_args("param").param, "Subscribing to unknown stream with ID 42");
+ assert.deepEqual(stub.get_args("param").param, "Subscribing to unknown stream with ID 101");
});
});
diff --git a/frontend_tests/node_tests/lib/events.js b/frontend_tests/node_tests/lib/events.js
index d44e23052bc..dc3ead0658d 100644
--- a/frontend_tests/node_tests/lib/events.js
+++ b/frontend_tests/node_tests/lib/events.js
@@ -17,6 +17,35 @@ exports.test_message = {
id: 99,
};
+const streams = {
+ devel: {
+ name: "devel",
+ description: ":devel fun:",
+ rendered_description: "<b>devel fun</b>",
+ invite_only: false,
+ stream_id: 101,
+ first_message_id: 1,
+ history_public_to_subscribers: false,
+ is_announcement_only: false,
+ is_web_public: false,
+ message_retention_days: null,
+ stream_post_policy: 1,
+ },
+ test: {
+ name: "test",
+ description: "test desc",
+ rendered_description: "test desc",
+ invite_only: true,
+ stream_id: 102,
+ first_message_id: 1,
+ history_public_to_subscribers: false,
+ is_web_public: false,
+ is_announcement_only: false,
+ message_retention_days: null,
+ stream_post_policy: 1,
+ },
+};
+
exports.fixtures = {
alert_words: {
type: "alert_words",
@@ -29,20 +58,7 @@ exports.fixtures = {
default_streams: {
type: "default_streams",
- default_streams: [
- {
- name: "devel",
- description: "devel",
- invite_only: false,
- stream_id: 1,
- },
- {
- name: "test",
- description: "test",
- invite_only: true,
- stream_id: 1,
- },
- ],
+ default_streams: [streams.devel, streams.test],
},
hotspots: {
@@ -354,7 +370,7 @@ exports.fixtures = {
stream__create: {
type: "stream",
op: "create",
- streams: [{stream_id: 42}, {stream_id: 99}],
+ streams: [streams.devel, streams.test],
},
stream__delete: {
@@ -377,11 +393,19 @@ exports.fixtures = {
op: "add",
subscriptions: [
{
- name: "devel",
- stream_id: 42,
- subscribers: ["[email protected]", "[email protected]"],
- email_address: "[email protected]:9991",
- // etc.
+ ...streams.devel,
+ audible_notifications: true,
+ color: "blue",
+ desktop_notifications: false,
+ email_address: "whatever",
+ email_notifications: false,
+ in_home_view: false,
+ is_muted: true,
+ pin_to_top: false,
+ push_notifications: false,
+ stream_weekly_traffic: 40,
+ wildcard_mentions_notify: false,
+ subscribers: [5, 8, 13, 21],
},
],
},