mirror of
https://github.com/immich-app/immich
synced 2026-08-22 13:13:05 +00:00
fix: shared check for server setup availability (#30311)
* fix: shared check for server setup availability * chore: add medium test * feat: require @Authenticated decorator everywhere * fix: lints
This commit is contained in:
parent
1f16fe16c2
commit
a316ba35ca
24 changed files with 249 additions and 66 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { BadRequestException } from '@nestjs/common';
|
||||
import { AuthController } from 'src/controllers/auth.controller';
|
||||
import { LoginResponseDto } from 'src/dtos/auth.dto';
|
||||
import { AuthService } from 'src/services/auth.service';
|
||||
|
|
@ -76,6 +77,18 @@ describe(AuthController.name, () => {
|
|||
.send({ name: 'admin', password: 'password', email: 'admin@local' });
|
||||
expect(status).toEqual(201);
|
||||
});
|
||||
|
||||
it('should not sign up an admin when setup is unavailable', async () => {
|
||||
ctx.requireSetupAvailable.mockRejectedValue(new BadRequestException('Admin setup is not available'));
|
||||
|
||||
const { status, body } = await request(ctx.getHttpServer())
|
||||
.post('/auth/admin-sign-up')
|
||||
.send({ name, email, password });
|
||||
|
||||
expect(status).toEqual(400);
|
||||
expect(body).toEqual(errorDto.badRequest('Admin setup is not available'));
|
||||
expect(service.adminSignUp).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('POST /auth/login', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue