Jest & Supertest not working with Express middleware routers

I’m using Node v18.8.0 and Express v4.18.2.
Say I had this app where I wanted to get a list of all phone codes from each country. This is my model:

// models/misc/phoneCodeModel.js
const mongoose = require('mongoose');
const phoneCodeSchema = new mongoose.Schema({
    countryCodes: {
        type: [String],
        required: [true, `To add a phone code you must specify the 'countryCodes' array`]
    },
    countryName: {
        type: String,
        required: [true, `To add a phone code you must specify the 'countryName'`]
    }
});

const PhoneCode = mongoose.model(`PhoneCode`, phoneCodeSchema);
module.exports = PhoneCode;

This is the controller:

// controllers/misc/phoneCodeController.js
const PhoneCode = require(`./../../models/misc/phoneCodeModel`);

exports.getPhoneCodes = async (req, res, next) => {
    const phoneCodes = await PhoneCode.find();

    res.status(200).json({
        status: 'success',
        data: {
            phoneCodes
        }
    });
};

exports.getPhoneCode = async (req, res, next) => {
    const phoneCode = await PhoneCode.findById(req.params.id);

    res.status(200).json({
        status: 'success',
        data: {
            phoneCode
        }
    });
};

This is the router:

// routes/misc/phoneCodeRoutes.js
const express = require('express');

const phoneCodeController = require(`./../../controllers/misc/phoneCodeController`);

const router = express.Router();
router.route('/')
    .get(phoneCodeController.getPhoneCodes);
router.route('/:id')
    .get(phoneCodeController.getPhoneCode);
module.exports = router;

This is the app.js file:

const express =  require('express');
const app = express();
app.use(express.json()); // Parse request/response into JSON objects

const phoneCodeRouter = require(`./routes/misc/phoneCodeRoutes`);

app.use('/api/v1/phoneCodes', phoneCodeRouter);
app.get('/test', (req, res) => {
    res.send("test")
});

app.all('*', (req, res, next) => {
    res.status(404).json({
        status: 'fail',
        message: `Can't find ${req.originalUrl} on this server!`
    });
});

module.exports = app;

There’s a server.js file that starts the app on port 8080…
Now the real question, if I try to make a test using Jest and Supertest:

// tests/test.js
const request = require('supertest');
const app = require('./../app');

describe('Phone codes', () => {
    
    describe('GET /phoneCodes', () => {
        test('Should response with a 200 status code', () => {
            return request(app).get('/api/v1/phoneCodes').expect(200);
        });
    });
    
});

I get the following error:

 FAIL  test/test.js (10.776 s)
  Phone codes
    GET /phoneCodes
      × Should response with a 200 status code (5016 ms)

  ● Phone codes › GET /phoneCodes › Should response with a 200 status code

    thrown: "Exceeded timeout of 5000 ms for a test.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

       5 |
       6 |      describe('GET /phoneCodes', () => {
    >  7 |              test('Should response with a 200 status code', () => {
         |              ^
       8 |                      return request(app).get('/api/v1/phoneCodes').expect(200);
       9 |              });
      10 |      });

      at test (test/test.js:7:3)
      at describe (test/test.js:6:2)
      at Object.describe (test/test.js:4:1)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        11.652 s
Ran all test suites.

Meanwhile from Postman I get the list correctly, and if I try to make the test on the ‘/test’ endpoint it works correctly:

const request = require('supertest');
const app = require('./../app');

describe('Phone codes', () => {
    
    describe('GET /phoneCodes', () => {
        test('Should response with a 200 status code', () => {
            return request(app).get('/test').expect(200);
        });
    });
    
});
 PASS  test/test.js
  Phone codes
    GET /phoneCodes
      √ Should response with a 200 status code (46 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        2.003 s, estimated 11 s
Ran all test suites.

Am I missing something? Why is it not working with my Express routes? I’m using Jest v29.5.0 and Supertest v6.3.3

I looked up the Supertest docs on NPM and used it’s default methods and chained them like in their examples (with and without the ‘done’ parameter), but no luck. I tried making async functions myself and evaluating the response later, same result. I don’t know what else to do. I tried increasing the timeout value as the error says but it doesn’t work either.