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.

web tests: Split the realm update_dict fixture by data variant.

Evy Kassirera39eb2dcd3b5
diff --git a/web/tests/dispatch.test.cjs b/web/tests/dispatch.test.cjs
index c89f90e8fa3..27dc1e8410f 100644
--- a/web/tests/dispatch.test.cjs
+++ b/web/tests/dispatch.test.cjs
@@ -760,7 +760,6 @@ run_test("realm settings", ({override}) => {
dispatch(event);
assert_same(realm.realm_media_preview_size, 150);
- event = event_fixtures.realm__update_dict__default;
override(realm, "realm_create_multiuse_invite_group", 1);
override(realm, "realm_allow_message_editing", false);
override(realm, "realm_message_content_edit_limit_seconds", 0);
@@ -797,7 +796,12 @@ run_test("realm settings", ({override}) => {
assert.deepEqual(sub, {...events.test_streams.devel, can_add_subscribers: false});
add_subscribers_element_updated = true;
});
- dispatch(event);
+ dispatch(event_fixtures.realm__update_dict__allow_message_editing);
+ dispatch(event_fixtures.realm__update_dict__message_content_edit_limit_seconds);
+ dispatch(event_fixtures.realm__update_dict__authentication_methods);
+ dispatch(event_fixtures.realm__update_dict__group_settings);
+ dispatch(event_fixtures.realm__update_dict__plan_type);
+ dispatch(event_fixtures.realm__update_dict__topics_policy);
assert_same(realm.realm_create_multiuse_invite_group, 3);
assert_same(realm.realm_allow_message_editing, true);
assert_same(realm.realm_message_content_edit_limit_seconds, 5);
@@ -813,6 +817,7 @@ run_test("realm settings", ({override}) => {
assert_same(realm.realm_can_resolve_topics_group, 1);
assert_same(realm.realm_direct_message_permission_group, 3);
assert_same(realm.realm_topics_policy, "disable_empty_topic");
+ assert_same(realm.realm_mandatory_topics, true);
assert_same(realm.realm_plan_type, 3);
assert_same(realm.realm_upload_quota_mib, 50000);
assert_same(realm.max_file_upload_size_mib, 1024);
diff --git a/web/tests/lib/events.cjs b/web/tests/lib/events.cjs
index 73d2fdd648f..01c7ae746e0 100644
--- a/web/tests/lib/events.cjs
+++ b/web/tests/lib/events.cjs
@@ -4,11 +4,10 @@ const {Role} = require("./example_user.cjs");
// These events are not guaranteed to be perfectly
// representative of what the server sends. We
-// have a tool called check-schemas that tries
-// to validate this data against server side schemas,
-// but there are certain edge cases that the tool now
-// skips. And even when the data matches the schema,
-// it may not be completely representative.
+// have a tool called check-schemas that validates
+// this data against server side schemas, but even
+// when the data matches the schema, it may not be
+// completely representative.
const test_user = {
@@ -470,17 +469,32 @@ exports.fixtures = {
value: 42,
},
- realm__update_dict__default: {
+ realm__update_dict__allow_message_editing: {
type: "realm",
op: "update_dict",
property: "default",
data: {
allow_message_editing: true,
- message_content_edit_limit_seconds: 5,
- create_multiuse_invite_group: 3,
+ },
+ },
+
+ realm__update_dict__authentication_methods: {
+ type: "realm",
+ op: "update_dict",
+ property: "default",
+ data: {
authentication_methods: {
Google: {enabled: true, available: true},
},
+ },
+ },
+
+ realm__update_dict__group_settings: {
+ type: "realm",
+ op: "update_dict",
+ property: "default",
+ data: {
+ create_multiuse_invite_group: 3,
can_add_custom_emoji_group: 3,
can_add_subscribers_group: 3,
can_create_bots_group: 3,
@@ -489,10 +503,6 @@ exports.fixtures = {
can_move_messages_between_topics_group: 3,
can_resolve_topics_group: 1,
direct_message_permission_group: 3,
- plan_type: 3,
- upload_quota_mib: 50000,
- max_file_upload_size_mib: 1024,
- topics_policy: "disable_empty_topic",
},
},
@@ -516,6 +526,15 @@ exports.fixtures = {
},
},
+ realm__update_dict__message_content_edit_limit_seconds: {
+ type: "realm",
+ op: "update_dict",
+ property: "default",
+ data: {
+ message_content_edit_limit_seconds: 5,
+ },
+ },
+
realm__update_dict__night_logo: {
type: "realm",
op: "update_dict",
@@ -526,6 +545,27 @@ exports.fixtures = {
},
},
+ realm__update_dict__plan_type: {
+ type: "realm",
+ op: "update_dict",
+ property: "default",
+ data: {
+ plan_type: 3,
+ upload_quota_mib: 50000,
+ max_file_upload_size_mib: 1024,
+ },
+ },
+
+ realm__update_dict__topics_policy: {
+ type: "realm",
+ op: "update_dict",
+ property: "default",
+ data: {
+ topics_policy: "disable_empty_topic",
+ mandatory_topics: true,
+ },
+ },
+
realm_bot__add: {
type: "realm_bot",
op: "add",