refactor(api): Move invitation validation to group static method

This commit is contained in:
Blade Barringer
2016-09-30 10:20:12 -05:00
parent 9b10f348cc
commit 76499412ed
4 changed files with 155 additions and 23 deletions

View File

@@ -69,9 +69,8 @@ describe('Post /groups/:groupId/invite', () => {
});
});
it('returns an error when uuids is empty and emails is undefined', async () => {
it('returns an error when uuids is empty and emails is not passed', async () => {
await expect(inviter.post(`/groups/${group._id}/invite`, {
emails: undefined,
uuids: [],
}))
.to.eventually.be.rejected.and.eql({
@@ -176,10 +175,9 @@ describe('Post /groups/:groupId/invite', () => {
});
});
it('returns an error when emails is empty and uuids is undefined', async () => {
it('returns an error when emails is empty and uuids is not passed', async () => {
await expect(inviter.post(`/groups/${group._id}/invite`, {
emails: [],
uuids: undefined,
}))
.to.eventually.be.rejected.and.eql({
code: 400,