resolve dev conflicts
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
22e69e6e91
commit
1c39ad873c
|
@ -110,7 +110,6 @@ module.exports = function(Self) {
|
||||||
|
|
||||||
const _setPassword = Self.prototype.setPassword;
|
const _setPassword = Self.prototype.setPassword;
|
||||||
Self.prototype.setPassword = async function(newPassword, options, cb) {
|
Self.prototype.setPassword = async function(newPassword, options, cb) {
|
||||||
console.log('ENTRY');
|
|
||||||
if (cb === undefined && typeof options === 'function') {
|
if (cb === undefined && typeof options === 'function') {
|
||||||
cb = options;
|
cb = options;
|
||||||
options = undefined;
|
options = undefined;
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
const {models} = require('vn-loopback/server/server');
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('Account setPassword()', () => {
|
describe('Account setPassword()', () => {
|
||||||
const ctx = {req: {accessToken: {userId: 9}}};
|
|
||||||
it('should throw an error when password does not meet requirements', async() => {
|
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();
|
await expectAsync(req).toBeRejected();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update password when it passes requirements', async() => {
|
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();
|
await expectAsync(req).toBeResolved();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('Client setPassword', () => {
|
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() => {
|
it('should throw an error the setPassword target is not just a client but a worker', async() => {
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await models.Client.setPassword(ctx, 1, 't0pl3v3l.p455w0rd!');
|
await models.Client.setPassword(1, 't0pl3v3l.p455w0rd!');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +17,7 @@ describe('Client setPassword', () => {
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await models.Client.setPassword(ctx, 1101, 't0pl3v3l.p455w0rd!');
|
await models.Client.setPassword(1101, 't0pl3v3l.p455w0rd!');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue