Test removing users from group
This commit is contained in:
parent
b8fe9671b1
commit
2dd8b078e5
|
@ -124,4 +124,35 @@ describe("syncGlobalUsers", () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("app users are removed when app is removed from user group", async () => {
|
||||||
|
await config.doInTenant(async () => {
|
||||||
|
const group = await proSdk.groups.save(structures.userGroups.userGroup())
|
||||||
|
const user1 = await config.createUser({ admin: false, builder: false })
|
||||||
|
const user2 = await config.createUser({ admin: false, builder: false })
|
||||||
|
await proSdk.groups.updateGroupApps(group.id, {
|
||||||
|
appsToAdd: [
|
||||||
|
{ appId: config.prodAppId!, roleId: roles.BUILTIN_ROLE_IDS.BASIC },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
await proSdk.groups.addUsers(group.id, [user1._id, user2._id])
|
||||||
|
|
||||||
|
await config.doInContext(config.appId, async () => {
|
||||||
|
await syncGlobalUsers()
|
||||||
|
expect(await rawUserMetadata()).toHaveLength(3)
|
||||||
|
|
||||||
|
await proSdk.groups.removeUsers(group.id, [user1._id])
|
||||||
|
await syncGlobalUsers()
|
||||||
|
|
||||||
|
const metadata = await rawUserMetadata()
|
||||||
|
expect(metadata).toHaveLength(2)
|
||||||
|
|
||||||
|
expect(metadata).not.toContainEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
_id: db.generateUserMetadataID(user1._id),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue