Skip to content

Commit

Permalink
test: fix test failure due to localhost being also ipv6
Browse files Browse the repository at this point in the history
  • Loading branch information
ikonst committed Oct 28, 2024
1 parent 2ae1c36 commit 65a3ea7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/supertest.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('request(url)', function () {
});

server = app.listen(function () {
const url = 'http://localhost:' + server.address().port;
const url = 'http://127.0.0.1:' + server.address().port;
request(url)
.get('/')
.expect('hello', done);
Expand All @@ -51,7 +51,7 @@ describe('request(url)', function () {
});

server = app.listen(function () {
const url = 'http://localhost:' + server.address().port;
const url = 'http://127.0.0.1:' + server.address().port;
const test = request(url).get('/');
test.end(function (err, res) {
this.should.eql(test);
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('request(app)', function () {
});

server = app.listen(function () {
const url = 'http://localhost:' + server.address().port;
const url = 'http://127.0.0.1:' + server.address().port;
request(url)
.get('/')
.end(function (err, res) {
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('request(app)', function () {
});

server = app.listen(function () {
const url = 'http://localhost:' + server.address().port;
const url = 'http://127.0.0.1:' + server.address().port;
request(url)
.get('/')
.timeout(1)
Expand All @@ -348,7 +348,7 @@ describe('request(app)', function () {
});

server = app.listen(function () {
const url = 'http://localhost:' + server.address().port;
const url = 'http://127.0.0.1:' + server.address().port;
server.close();
request(url)
.get('/')
Expand Down Expand Up @@ -381,7 +381,7 @@ describe('request(app)', function () {

describe('.expect(status)', function () {
it('should handle connection error', function (done) {
const req = request.agent('http://localhost:1234');
const req = request.agent('http://127.0.0.1:1234');

req
.get('/')
Expand Down

0 comments on commit 65a3ea7

Please sign in to comment.