Skip to content

Commit

Permalink
test(http-server): add explicit tests for IPv4 and IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
bajtos committed Mar 5, 2019
1 parent aa0e2f7 commit e6f27aa
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,22 @@ describe('HttpServer (integration)', () => {
await expect(anotherServer.start()).to.be.rejectedWith(/EADDRINUSE/);
});

it('supports HTTP over IPv4', async () => {
server = new HttpServer(dummyRequestHandler, {host: '127.0.0.1'});
await server.start();
expect(server.address!.family).to.equal('IPv4');
const response = await httpGetAsync(server.url);
expect(response.statusCode).to.equal(200);
});

itSkippedOnTravis('supports HTTP over IPv6', async () => {
server = new HttpServer(dummyRequestHandler, {host: '::1'});
await server.start();
expect(server.address!.family).to.equal('IPv6');
const response = await httpGetAsync(server.url);
expect(response.statusCode).to.equal(200);
});

it('supports HTTPS protocol with key and certificate files', async () => {
const serverOptions = givenHttpServerConfig();
const httpsServer: HttpServer = givenHttpsServer(serverOptions);
Expand Down

0 comments on commit e6f27aa

Please sign in to comment.