Skip to content

Commit e014bbf

Browse files
SatoshiRoppongizahin-mohammad
authored andcommitted
test(express): verify absence of keepAliveTimeout and headersTimeout when unspecified
TICKET: WP-4029
1 parent 903b842 commit e014bbf

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

modules/express/test/unit/bitgoExpress.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,5 +601,45 @@ describe('Bitgo Express', function () {
601601

602602
createServerStub.restore();
603603
});
604+
605+
it('should not set keepAliveTimeout and headersTimeout if not specified in config for HTTP server', async function () {
606+
const createServerStub = sinon.stub(http, 'createServer').callsFake(() => {
607+
return { listen: sinon.stub(), setTimeout: sinon.stub() } as unknown as http.Server;
608+
});
609+
610+
const args: any = {
611+
env: 'test',
612+
bind: 'localhost',
613+
// keepAliveTimeout and headersTimeout are not specified
614+
};
615+
616+
const server = await createServer(args, null as any);
617+
618+
should(server.keepAliveTimeout).be.undefined();
619+
should(server.headersTimeout).be.undefined();
620+
621+
createServerStub.restore();
622+
});
623+
624+
it('should not set keepAliveTimeout and headersTimeout if not specified in config for HTTPS server', async function () {
625+
const createServerStub = sinon.stub(https, 'createServer').callsFake(() => {
626+
return { listen: sinon.stub(), setTimeout: sinon.stub() } as unknown as https.Server;
627+
});
628+
629+
const args: any = {
630+
env: 'test',
631+
bind: 'localhost',
632+
sslKey: 'ssl-key',
633+
sslCert: 'ssl-cert',
634+
// keepAliveTimeout and headersTimeout are not specified
635+
};
636+
637+
const server = await createServer(args, null as any);
638+
639+
should(server.keepAliveTimeout).be.undefined();
640+
should(server.headersTimeout).be.undefined();
641+
642+
createServerStub.restore();
643+
});
604644
});
605645
});

0 commit comments

Comments
 (0)