jest-node-http
Version:
33 lines • 1.2 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Agent {
constructor(options) {
this.agentOptions = Object.assign({}, options);
this.keepAliveMsecs = this.agentOptions.keepAliveMsecs || 1000;
this.keepAlive = this.agentOptions.keepAlive || false;
this.maxSockets = this.agentOptions.maxSockets || Infinity;
this.maxFreeSockets = this.agentOptions.maxFreeSockets || 256;
this.createConnection = jest.fn();
this.keepSocketAlive = jest.fn();
this.reuseSocket = jest.fn();
this.destroy = jest.fn();
this.getName = jest.fn();
this.freeSockets = jest.fn();
this.requests = jest.fn();
this.sockets = jest.fn();
return this;
}
resetMocked() {
this.createConnection.mockReset();
this.keepSocketAlive.mockReset();
this.reuseSocket.mockReset();
this.destroy.mockReset();
this.freeSockets.mockReset();
this.getName.mockReset();
this.requests.mockReset();
this.sockets.mockReset();
}
}
exports.Agent = Agent;
exports.globalAgent = () => new Agent();
//# sourceMappingURL=Agent.js.map