kuzzle-sdk
Version:
Official Javascript SDK for Kuzzle
44 lines • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const cucumber_1 = require("@cucumber/cucumber");
(0, cucumber_1.Given)("there is an user with id {string}", async function (id) {
this.user = id;
try {
await this.kuzzle.security.createOrReplaceProfile("test", {
policies: [{ roleId: "admin" }],
});
const content = await this.kuzzle.security.createUser(id, {
content: {
profileIds: ["test"],
},
credentials: {},
});
this.content = content;
}
catch {
/* do nothing */
}
});
(0, cucumber_1.Given)("the user has {string} credentials with name {string} and password {string}", async function (strategy, username, password) {
try {
await this.kuzzle.security.createCredentials(strategy, this.user, {
username,
password,
});
}
catch {
await this.kuzzle.security.updateCredentials(strategy, this.user, {
username,
password,
});
}
});
(0, cucumber_1.When)("I get my user info", async function () {
this.content = await this.kuzzle.security.getUser(this.user);
});
(0, cucumber_1.When)("I update my user custom data with the pair {string}:{string}", async function (key, val) {
this.content = await this.kuzzle.security.updateUser(this.user, {
[key]: val,
});
});
//# sourceMappingURL=security.js.map