I have a nestjs backend api server within a monorepo. I want to do integration test using supertest. I have currently configured e2e against jest --env=node --verbose
command in package.json.
For example, check if http://localhost:8112/health return OK.
it('should pass', async () => {
const res = await request(http://localhost:8112/health)
.get('/health')
.expect(200);
expect(res.text).toEqual('OK');
});
I want the api url endpoint to be dynamic. If its staging stg-xyz.com/health or if prod prod-xyz.com. How do i achieve the same?