kuzzle-sdk
Version:
Official Javascript SDK for Kuzzle
46 lines • 1.85 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const cucumber_1 = require("@cucumber/cucumber");
const should_1 = __importDefault(require("should"));
(0, cucumber_1.Given)("Kuzzle Server is running", function () {
return this.kuzzle.connect();
});
(0, cucumber_1.Then)(/^I get an error(?: with status (.*))?$/, function (status) {
(0, should_1.default)(this.error).not.be.null();
if (status) {
(0, should_1.default)(this.error.status).eql(parseInt(status, 10));
}
});
(0, cucumber_1.Then)("I get {string} and {string}", function (string1, string2) {
(0, should_1.default)(this.content).be.an.Array();
(0, should_1.default)(this.content.length).eql(2);
for (const val of [string1, string2]) {
(0, should_1.default)(this.content.indexOf(val)).be.greaterThanOrEqual(0);
}
});
(0, cucumber_1.Then)("the content should not be null", function () {
(0, should_1.default)(this.content).not.be.null();
});
(0, cucumber_1.Then)(/^the response '(.*)' field contains the pair '(.*)':'(.*)'$/, function (field, key, val) {
(0, should_1.default)(this.content[field][key]).eql(val);
});
(0, cucumber_1.Then)(/^I shall receive (.*?)$/, function (value) {
let expected = value;
if (/^\d+$/.test(value)) {
expected = parseInt(value, 10);
}
else if (/^[\d.]+$/.test(value)) {
expected = parseFloat(value);
}
else if (/(true|false)/.test(value)) {
expected = value === "true";
}
(0, should_1.default)(this.content).eql(expected);
});
(0, cucumber_1.Then)("the result contains {int} hits", function (hits) {
(0, should_1.default)(this.total).eql(hits);
});
//# sourceMappingURL=kuzzle.js.map