diff --git a/src/v1/account-removal/account-removal.controller.ts b/src/v1/account-removal/account-removal.controller.ts index 9fca442..ae5e51f 100644 --- a/src/v1/account-removal/account-removal.controller.ts +++ b/src/v1/account-removal/account-removal.controller.ts @@ -21,9 +21,7 @@ import { RequestAccountRemovalDto } from './dto/request-account-removal.dto'; @ApiTags('account-removal') @Controller({ path: 'account-removal', version: '1' }) export class AccountRemovalController { - constructor( - private readonly accountRemovalService: AccountRemovalService, - ) {} + constructor(private readonly accountRemovalService: AccountRemovalService) {} @Throttle({ default: { ttl: 60_000, limit: 10 } }) @Get('challenge') @@ -38,8 +36,7 @@ export class AccountRemovalController { @Post('request') @HttpCode(HttpStatus.ACCEPTED) @ApiOperation({ - summary: - 'Submit an account removal request (public; emails the operators)', + summary: 'Submit an account removal request (public; emails the operators)', }) async submitRequest( @Body() body: RequestAccountRemovalDto, diff --git a/src/v1/account-removal/account-removal.service.spec.ts b/src/v1/account-removal/account-removal.service.spec.ts index ceb2b27..f2cdb63 100644 --- a/src/v1/account-removal/account-removal.service.spec.ts +++ b/src/v1/account-removal/account-removal.service.spec.ts @@ -5,7 +5,7 @@ import { import type { ConfigService } from '@nestjs/config'; import { AccountRemovalService } from './account-removal.service'; -const sendMailMock = jest.fn(); +const sendMailMock = jest.fn((_mail: unknown) => Promise.resolve()); jest.mock('nodemailer', () => ({ createTransport: jest.fn(() => ({ sendMail: sendMailMock })), @@ -43,7 +43,9 @@ describe('AccountRemovalService', () => { expect(Number.isInteger(a)).toBe(true); expect(Number.isInteger(b)).toBe(true); - expect(() => service.verifyChallenge(a + b, challenge.token)).not.toThrow(); + expect(() => + service.verifyChallenge(a + b, challenge.token), + ).not.toThrow(); }); it('rejects a wrong answer', () => { diff --git a/src/v1/account-removal/account-removal.service.ts b/src/v1/account-removal/account-removal.service.ts index 8661dfd..b459d13 100644 --- a/src/v1/account-removal/account-removal.service.ts +++ b/src/v1/account-removal/account-removal.service.ts @@ -1,8 +1,4 @@ -import { - createHmac, - randomInt, - timingSafeEqual, -} from 'crypto'; +import { createHmac, randomInt, timingSafeEqual } from 'crypto'; import { BadRequestException, Injectable, @@ -137,9 +133,7 @@ export class AccountRemovalService { const user = this.configService.get('SMTP_USER'); const pass = this.configService.get('SMTP_PASS'); if (!host || !user || !pass) { - throw new ServiceUnavailableException( - 'Email delivery is not configured', - ); + throw new ServiceUnavailableException('Email delivery is not configured'); } const port = Number(this.configService.get('SMTP_PORT') ?? '465');