refactor(server): auth dtos ()

* refactor: auth dtos

* chore: open api
This commit is contained in:
Jason Rasmussen 2023-11-09 10:14:15 -05:00 committed by GitHub
commit 5423f1c25b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 187 additions and 657 deletions
server/test/e2e

View file

@ -8,7 +8,6 @@ import {
errorStub,
loginResponseStub,
loginStub,
signupResponseStub,
uuidStub,
} from '@test/fixtures';
import { testApp } from '@test/test-utils';
@ -19,6 +18,24 @@ const lastName = 'Admin';
const password = 'Password123';
const email = 'admin@immich.app';
const adminSignupResponse = {
id: expect.any(String),
firstName: 'Immich',
lastName: 'Admin',
email: 'admin@immich.app',
storageLabel: 'admin',
externalPath: null,
profileImagePath: '',
// why? lol
shouldChangePassword: true,
isAdmin: true,
createdAt: expect.any(String),
updatedAt: expect.any(String),
deletedAt: null,
oauthId: '',
memoriesEnabled: true,
};
describe(`${AuthController.name} (e2e)`, () => {
let server: any;
let accessToken: string;
@ -84,7 +101,7 @@ describe(`${AuthController.name} (e2e)`, () => {
.post('/auth/admin-sign-up')
.send({ ...adminSignupStub, email: 'admin@local' });
expect(status).toEqual(201);
expect(body).toEqual({ ...signupResponseStub, email: 'admin@local' });
expect(body).toEqual({ ...adminSignupResponse, email: 'admin@local' });
});
it('should transform email to lower case', async () => {
@ -92,7 +109,7 @@ describe(`${AuthController.name} (e2e)`, () => {
.post('/auth/admin-sign-up')
.send({ ...adminSignupStub, email: 'aDmIn@IMMICH.app' });
expect(status).toEqual(201);
expect(body).toEqual(signupResponseStub);
expect(body).toEqual(adminSignupResponse);
});
it('should not allow a second admin to sign up', async () => {