UNPKG

@xmt/server-framework

Version:

Backend Server Framework of XmT Inc.

24 lines 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const superagent = require("superagent"); const chai_1 = require("chai"); 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(); chai_1.expect(ip).to.be.a("object"); chai_1.expect(ip).to.have.ownProperty("remoteAddress"); chai_1.expect(ip).to.have.ownProperty("remoteFamily"); chai_1.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