This repository was archived by the owner on Jul 15, 2026. It is now read-only.
Description Describe the bug
I was dumb and passed uninitialized app: Express.Application variable.
I got the following error:
TypeError: Cannot read properties of undefined (reading 'address')
137 | ],
138 | };
> 139 | const response = await requestSender.merger({
| ^
140 | requestBody: body,
141 | });
142 |
at Test.serverAddress (node_modules/supertest/lib/test.js:46:22)
at new Test (node_modules/supertest/lib/test.js:34:14)
at TestAgent.<computed> [as post] (node_modules/supertest/lib/agent.js:64:17)
at sendRequest (node_modules/@map-colonies/openapi-helpers/src/requestSender/requestSender.ts:27:45)
at Object.returnObj.<computed> [as merger] (node_modules/@map-colonies/openapi-helpers/src/requestSender/requestSender.ts:122:7)
at Object.merger (tests/integration/merger/merge.spec.ts:139:44)
To Reproduce
Steps to reproduce the behavior:
Create test like the following
pass undefined instead of app
See error
Expected behavior
I would like to get an error that app property was passed as undefined instead of current message.
Additional context
Example code:
describe('merge', function () {
let app: Application;
let configInstance: ConfigType;
let requestSender: RequestSender<paths, operations>;
beforeAll(async function () {
await initConfig(true);
configInstance = getConfig();
const [initializeApp] = await getApp({
override: [
{
token: SERVICES.CONFIG,
provider: { useValue: configInstance },
},
{ token: SERVICES.LOGGER, provider: { useValue: jsLogger({ enabled: false }) } },
{
token: SERVICES.TRACER,
provider: {
useValue: trace.getTracer('test-tracer'),
},
},
],
useChild: true,
});
requestSender = await createRequestSender<paths, operations>('openapi3.yaml', app);
app = initializeApp;
});
describe('Happy Path', function () {
it('should return 200 status code and the resource', async function () {
const body = ....
const response = await requestSender.merger({
requestBody: body,
});
expect(response).toHaveProperty('status', httpStatusCodes.OK);
expect(response).toHaveProperty('body', expected);
});
});
});
Reactions are currently unavailable
Describe the bug
I was dumb and passed uninitialized
app: Express.Applicationvariable.I got the following error:
To Reproduce
Steps to reproduce the behavior:
appExpected behavior
I would like to get an error that app property was passed as undefined instead of current message.
Additional context
Example code: