Files
zulip/web/tests/lib/example_group.cjs
Kislay Verma c134cc398f tests: Add library function to create user groups.
This is done to ensure the objects exactly match
the schema/types during tests.

Fixes part of #32326.
2025-08-11 11:57:49 -07:00

32 lines
745 B
JavaScript

"use strict";
let last_issued_group_id = 20000;
const get_group_id = () => {
last_issued_group_id += 1 + Math.floor(Math.random() * 10);
return last_issued_group_id;
};
exports.make_user_group = (opts = {}) => {
const id = opts.id ?? get_group_id();
return {
description: "Dummy user group",
id,
creator_id: 1,
date_created: null,
name: "Example user group",
members: [],
is_system_group: false,
direct_subgroup_ids: [],
can_add_members_group: 0,
can_join_group: 0,
can_leave_group: 0,
can_manage_group: 0,
can_mention_group: 0,
can_remove_members_group: 0,
deactivated: false,
...opts,
};
};