user_group_pill: Add test coverage for `append_user_group`.

This commit is contained in:
Lalit 2023-07-15 22:46:44 +05:30 committed by Tim Abbott
parent 8aa6ddfe68
commit 61d4670f9a
1 changed files with 18 additions and 0 deletions

View File

@ -70,3 +70,21 @@ run_test("get_group_ids", () => {
const group_ids = user_group_pill.get_group_ids(widget); const group_ids = user_group_pill.get_group_ids(widget);
assert.deepEqual(group_ids, [101, 102]); assert.deepEqual(group_ids, [101, 102]);
}); });
run_test("append_user_group", () => {
const items = [admins_pill];
const widget = {
appendValidatedData(group) {
assert.deepEqual(group, testers_pill);
items.push(testers_pill);
},
clear_text() {},
};
const group = {
...testers,
members: new Set(testers.members),
};
user_group_pill.append_user_group(group, widget);
assert.deepEqual(items, [admins_pill, testers_pill]);
});