How to properly test middlewares?

I have a problem with testing my middlewares in NodeJS, here is my code:

middleware:

export const requestMiddleware = (req: Request, res: Response, next: () => void) => {
    //some stuff

    next(); //TypeError: next is not a function ---- error from Jest
}

and my middleware.test.ts

describe('errorHandler', () => {
  const req: Request;
  const res: Response;
  const next: () => void;

    beforeEach(() => {
      req = {
        headers: {some: "stuff"},
        method: "GET",
      } as Request;
      res = new Response(req);
      next = jest.fn();
    });

  test('should test middleware', () => {
    requestMiddleware (req, res, next);
    console.log("RES: ", res);

    expect(res.statusCode).toBeDefined()
    expect(res.statusCode).toBe(500)
  })
})

when I launch above test the Jest return me this:

  ● requestMiddleware › should test middleware

    TypeError: next is not a function

      67 |
    > 68 |     next(error);
         |     ^
      69 |   }
      70 |

      at requestMiddleware (src/middlewares/handlers.ts:68:5)

can someone tell me why my next() function in requestMiddleware is not properly mocked by Jest?

thanks for any help!