mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-27 19:21:26 +00:00
docs: fix createUser and test docs
this ports the fixes applied to createGroup to this method as well Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
0470497ccb
commit
c9be26235c
2 changed files with 3 additions and 2 deletions
|
@ -52,12 +52,13 @@ describe('UsersService', () => {
|
|||
.spyOn(userRepo, 'save')
|
||||
.mockImplementationOnce(async (user: User): Promise<User> => user);
|
||||
});
|
||||
it('works', async () => {
|
||||
it('successfully creates a user', async () => {
|
||||
const user = await service.createUser(username, displayname);
|
||||
expect(user.username).toEqual(username);
|
||||
expect(user.displayName).toEqual(displayname);
|
||||
});
|
||||
it('fails if username is already taken', async () => {
|
||||
// add additional mock implementation for failure
|
||||
jest.spyOn(userRepo, 'save').mockImplementationOnce(() => {
|
||||
throw new Error();
|
||||
});
|
||||
|
|
|
@ -26,7 +26,7 @@ export class UsersService {
|
|||
* @async
|
||||
* Create a new user with a given username and displayName
|
||||
* @param username - the username the new user shall have
|
||||
* @param displayName - the display the new user shall have
|
||||
* @param displayName - the display name the new user shall have
|
||||
* @return {User} the user
|
||||
* @throws {AlreadyInDBError} the username is already taken.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue