Removes duplicate func and adds tests.

This commit is contained in:
gaba
2017-01-31 14:04:31 -08:00
parent 37eae51641
commit 282c7dc4f5
3 changed files with 27 additions and 22 deletions
+19
View File
@@ -178,6 +178,25 @@ describe('services.UsersService', () => {
});
});
describe('#setDisplayName', () => {
it('should set the display name to a new unique one', () => {
return UsersService
.setDisplayName(mockUsers[0].id, 'maria')
.then(() => UsersService.findById(mockUsers[0].id))
.then((user) => {
expect(user).to.have.property('displayName', 'maria');
});
});
it('should return an error when the displayName is not unique', () => {
return UsersService
.setDisplayName(mockUsers[0].id, 'marvel')
.catch((error) => {
expect(error).to.not.be.null;
});
});
});
describe('#ban', () => {
it('should set the status to banned', () => {
return UsersService