Merge pull request #3064 from overleaf/ta-manage-multiple-groups

Allow Users to Manage Multiple Groups

GitOrigin-RevId: c918da0114cdd1d679223f69d81159b4c2608874
This commit is contained in:
Timothée Alby
2020-08-13 02:06:20 +00:00
committed by Copybot
parent 29f09c50c2
commit 8cd6e7ccfc
9 changed files with 41 additions and 89 deletions
+1 -20
View File
@@ -23,11 +23,10 @@ describe('mongoose', function() {
})
describe('Subsription', function() {
let user, otherUser
let user
beforeEach(async function() {
user = await User.create({ email: 'wombat@potato.net' })
otherUser = await User.create({ email: 'giraffe@turnip.org' })
})
it('allows the creation of a subscription', async function() {
@@ -41,23 +40,5 @@ describe('mongoose', function() {
it('does not allow the creation of a subscription without a manager', async function() {
await expect(Subscription.create({ admin_id: user._id })).to.be.rejected
})
it('does not allow a user to manage more than one group', async function() {
await expect(
Subscription.create({ admin_id: user._id, manager_ids: [user._id] })
).to.be.fulfilled
await expect(
Subscription.create({
admin_id: otherUser._id,
manager_ids: [otherUser._id]
})
).to.be.fulfilled
await expect(
Subscription.update(
{ admin_id: user._id },
{ $push: { manager_ids: otherUser._id } }
)
).to.be.rejected
})
})
})