From 5878218520cdb0deca28832b63c7a25e80202948 Mon Sep 17 00:00:00 2001 From: Myrotvorets Date: Fri, 20 Dec 2024 05:24:01 +0200 Subject: [PATCH] Update code --- test/index.test.mts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/index.test.mts b/test/index.test.mts index 5ad49af..11d3590 100644 --- a/test/index.test.mts +++ b/test/index.test.mts @@ -1,22 +1,26 @@ /* eslint-disable sonarjs/assertions-in-tests */ import { describe, it } from 'node:test'; +import type { RequestListener } from 'node:http'; import request from 'supertest'; -import express, { Application, NextFunction, Request, Response } from 'express'; +import express, { type NextFunction, type Request, type Response } from 'express'; import { acceptsJsonMiddleware } from '../src/index.mjs'; interface IStatus { status: number; } -function buildServer(): Application { +function buildServer(): RequestListener { const app = express(); app.disable('x-powered-by'); return app.use( acceptsJsonMiddleware, - (_req: Request, res: Response): unknown => res.json({ status: 200 }), - (err: unknown, _req: Request, res: Response, _next: NextFunction): unknown => - res.status((err as IStatus).status).json(err), - ); + (_req: Request, res: Response) => { + res.json({ status: 200 }); + }, + (err: unknown, _req: Request, res: Response, _next: NextFunction): void => { + res.status((err as IStatus).status).json(err); + }, + ) as RequestListener; } const server = buildServer();