feat(user-info-dto): split email into separate DTO

The email address should only be available
in /me routes.
This commit splits the email address into a new FullUserInfoDto.

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-02-20 22:18:51 +01:00
parent a7edf00ebc
commit 0394679134
7 changed files with 44 additions and 12 deletions

View file

@ -9,7 +9,7 @@ import request from 'supertest';
import { AuthConfig } from '../../src/config/auth.config';
import { NotInDBError } from '../../src/errors/errors';
import { Note } from '../../src/notes/note.entity';
import { UserInfoDto } from '../../src/users/user-info.dto';
import { FullUserInfoDto } from '../../src/users/user-info.dto';
import { User } from '../../src/users/user.entity';
import { setupSessionMiddleware } from '../../src/utils/session';
import { TestSetup, TestSetupBuilder } from '../test-setup';
@ -50,12 +50,12 @@ describe('Me', () => {
});
it('GET /me', async () => {
const userInfo = testSetup.userService.toUserDto(user);
const userInfo = testSetup.userService.toFullUserDto(user);
const response = await agent
.get('/api/private/me')
.expect('Content-Type', /json/)
.expect(200);
const gotUser = response.body as UserInfoDto;
const gotUser = response.body as FullUserInfoDto;
expect(gotUser).toEqual(userInfo);
});