@hpcc-js/comms
Version:
hpcc-js - Communications
60 lines • 2.22 kB
JavaScript
import * as https from "https";
import { ESPConnection } from "../espConnection";
import { WorkunitsService } from "../services/wsWorkunits";
import { trustwave } from "../pem/trustwave";
import { expect } from "chai";
var extraRootAgent = new https.Agent({
ca: trustwave
});
var acceptUnauthorizedAgent = new https.Agent({
rejectUnauthorized: false
});
describe("https", function () {
it("fetch fail", function () {
var hasResponse = false;
return fetch("https://play.hpccsystems.com:18010/WsWorkunits/WUQuery.json").then(function (response) {
hasResponse = true;
}).catch(function (e) {
return true;
}).then(function () {
expect(hasResponse).to.be.false;
});
});
it("fetch with trustwave", function () {
return fetch("https://play.hpccsystems.com:18010/WsWorkunits/WUQuery.json", { agent: extraRootAgent }).then(function (response) {
return true;
}).catch(function (e) {
throw e;
});
});
it("fetch acceptUnauthorized", function () {
return fetch("https://play.hpccsystems.com:18010/WsWorkunits/WUQuery.json", { agent: acceptUnauthorizedAgent }).then(function (response) {
return true;
}).catch(function (e) {
throw e;
});
});
it("generic", function () {
return fetch("https://jsonplaceholder.typicode.com/todos/1").then(function (response) {
return response.json();
}).then(function (json) {
console.info(json);
}).catch(function (e) {
console.info(e.message);
throw e;
});
});
it("ESPConnection", function () {
var connection = new ESPConnection({ baseUrl: "https://play.hpccsystems.com:18010/" }, "WsWorkunits", "1.8");
return connection.send("WUQuery", {}).then(function (response) {
return true;
});
});
it("WsWorkunits", function () {
var service = new WorkunitsService({ baseUrl: "https://play.hpccsystems.com:18010" });
return service.WUQuery({}).then(function (response) {
return true;
});
});
});
//# sourceMappingURL=https.js.map