test: add test for #12446

This commit is contained in:
Barış Soner Uşaklı
2024-03-26 18:59:11 -04:00
parent ed41e416e2
commit bf4e257c83

View File

@@ -914,6 +914,19 @@ describe('Groups', () => {
assert(!isInvited); assert(!isInvited);
}); });
it('should fail to rescind last owner', async () => {
const uid = await User.create({ username: 'lastgroupowner' });
await Groups.create({
name: 'last owner',
description: 'Foobar!',
ownerUid: uid,
});
await assert.rejects(
apiGroups.rescind({ uid: adminUid }, { slug: 'last-owner', uid: uid }),
{ message: '[[error:group-needs-owner]]' },
);
});
it('should error if user is not invited', async () => { it('should error if user is not invited', async () => {
await assert.rejects( await assert.rejects(
apiGroups.acceptInvite({ uid: adminUid }, { slug: 'privatecanjoin', uid: adminUid }), apiGroups.acceptInvite({ uid: adminUid }, { slug: 'privatecanjoin', uid: adminUid }),