xmt-base
Version:
Backend Server Framework of XmT Inc.
23 lines • 992 B
JavaScript
;
const superagent = require("superagent");
const expect = require("chai").expect;
const interface_1 = require("../../lib/interface");
describe("Request.xmt_getIP()", function () {
it("Should return the remote ip which consists of remoteAddress, remoteFamily and remotePort properties", function (done) {
const router = new interface_1.Router();
router.xmt_common(function (request, response) {
let ip = request.xmt_getIP();
expect(ip).to.be.a("object");
expect(ip).to.have.ownProperty("remoteAddress");
expect(ip).to.have.ownProperty("remoteFamily");
expect(ip).to.have.ownProperty("remotePort");
response.xmt_send();
});
const server = router.xmt_listen(7777);
superagent.get("http://localhost:7777")
.end(function (error, response) {
server.close(done);
});
});
});
//# sourceMappingURL=xmt_getIP.js.map