resolve dev conflicts
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-06-12 11:06:45 +02:00
parent 22e69e6e91
commit 1c39ad873c
3 changed files with 4 additions and 7 deletions

View File

@ -110,7 +110,6 @@ module.exports = function(Self) {
const _setPassword = Self.prototype.setPassword;
Self.prototype.setPassword = async function(newPassword, options, cb) {
console.log('ENTRY');
if (cb === undefined && typeof options === 'function') {
cb = options;
options = undefined;

View File

@ -1,15 +1,14 @@
const {models} = require('vn-loopback/server/server');
describe('Account setPassword()', () => {
const ctx = {req: {accessToken: {userId: 9}}};
it('should throw an error when password does not meet requirements', async() => {
let req = models.Account.setPassword(ctx, 1, 'insecurePass');
let req = models.Account.setPassword(1, 'insecurePass');
await expectAsync(req).toBeRejected();
});
it('should update password when it passes requirements', async() => {
let req = models.Account.setPassword(ctx, 1, 'Very$ecurePa22.');
let req = models.Account.setPassword(1, 'Very$ecurePa22.');
await expectAsync(req).toBeResolved();
});

View File

@ -1,12 +1,11 @@
const models = require('vn-loopback/server/server').models;
describe('Client setPassword', () => {
const ctx = {req: {accessToken: {userId: 9}}};
it('should throw an error the setPassword target is not just a client but a worker', async() => {
let error;
try {
await models.Client.setPassword(ctx, 1, 't0pl3v3l.p455w0rd!');
await models.Client.setPassword(1, 't0pl3v3l.p455w0rd!');
} catch (e) {
error = e;
}
@ -18,7 +17,7 @@ describe('Client setPassword', () => {
let error;
try {
await models.Client.setPassword(ctx, 1101, 't0pl3v3l.p455w0rd!');
await models.Client.setPassword(1101, 't0pl3v3l.p455w0rd!');
} catch (e) {
error = e;
}