@hpcc-js/comms
Version:
hpcc-js - Communications
71 lines • 2.75 kB
JavaScript
import { __awaiter, __generator } from "tslib";
import { expect } from "chai";
import { Workunit, WorkunitsService } from "../index.node";
var connection = { baseUrl: "http://localhost:8010/" };
describe("Workunit", function () {
it("basic", function () {
expect(Workunit).to.exist;
});
it("clone", function () { return __awaiter(void 0, void 0, void 0, function () {
var wu, newWu;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Workunit.create(connection)];
case 1:
wu = _a.sent();
return [4 /*yield*/, wu.update({ QueryText: "123;" })];
case 2:
_a.sent();
return [4 /*yield*/, wu.submit("thor")];
case 3:
_a.sent();
return [4 /*yield*/, wu.watchUntilComplete()];
case 4:
_a.sent();
return [4 /*yield*/, wu.clone()];
case 5:
newWu = _a.sent();
expect(newWu).to.exist;
return [4 /*yield*/, newWu.delete()];
case 6:
_a.sent();
return [4 /*yield*/, wu.delete()];
case 7:
_a.sent();
return [2 /*return*/];
}
});
}); });
it("ping", function () { return __awaiter(void 0, void 0, void 0, function () {
var service, pingResponse;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
service = new WorkunitsService(connection);
return [4 /*yield*/, service.Ping()];
case 1:
pingResponse = _a.sent();
expect(pingResponse).to.exist;
return [2 /*return*/];
}
});
}); });
it.skip("query", function () { return __awaiter(void 0, void 0, void 0, function () {
var wus, names;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Workunit.query(connection, {})];
case 1:
wus = _a.sent();
expect(wus).to.have.length;
expect(wus.length).to.be.greaterThan(0);
return [4 /*yield*/, wus[0].fetchServiceNames()];
case 2:
names = _a.sent();
console.info(names);
return [2 /*return*/];
}
});
}); });
});
//# sourceMappingURL=workunit.js.map