Skip to content

Commit

Permalink
test: fixed not trigger req in lookup testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
yunnysunny committed Jan 21, 2022
1 parent 07e748f commit 356e525
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/node/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@
const assert = require('assert');
const dns = require('dns');
const request = require('../support/client');
const setup = require('../support/setup');
const getSetup = require('../support/setup');

const base = setup.uri;
let base = null;

function myLookup(hostname, options, callback) {
dns.lookup(hostname, options, callback);
}

describe('req.lookup()', () => {
it('should set a custom lookup', () => {
before(async () => {
const setup = await getSetup();
base = setup.uri;
});
it('should set a custom lookup', (done) => {
const r = request.get(`${base}/ok`).lookup(myLookup);
assert(r.lookup() === myLookup);
r.then((res) => {
res.text.should.equal('ok');
done();
});
});
});

0 comments on commit 356e525

Please sign in to comment.