From 287bc3bdcf75c160b1ddf645009b9c9165d920a7 Mon Sep 17 00:00:00 2001 From: "Bernhard K. Weisshuhn" Date: Tue, 19 Jun 2018 19:08:34 +0200 Subject: [PATCH] test agent option `family` being passed to `lookup` --- test/test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test.js b/test/test.js index e3a7113..65a0357 100644 --- a/test/test.js +++ b/test/test.js @@ -1545,6 +1545,22 @@ describe('node-fetch', () => { expect(called).to.equal(2); }); }); + + it("supports supplying a famliy option to the agent", function() { + const url = `${base}redirect/301`; + const families = []; + const family = Symbol('family'); + function lookupSpy(hostname, options, callback) { + families.push(options.family) + return lookup(hostname, {}, callback); + } + const agent = http.Agent({ lookup: lookupSpy, family }); + return fetch(url, { agent }).then(() => { + expect(families).to.have.length(2); + expect(families[0]).to.equal(family); + expect(families[1]).to.equal(family); + }); + }); }); describe('Headers', function () {