From 4479337731c67485d0bc72c43960b9238316b905 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 10:59:13 +0200 Subject: [PATCH] Updated test --- Jenkinsfile | 2 +- back/methods/account/specs/change-password.spec.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 97fec5b48..f1ab01af9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -122,7 +122,7 @@ pipeline { if (!['master', 'test'].contains(env.BRANCH_NAME)) { try { // junit 'junitresults.xml' - junit 'junit.xml' + // junit 'junit.xml' } catch (e) { echo e.toString() } diff --git a/back/methods/account/specs/change-password.spec.js b/back/methods/account/specs/change-password.spec.js index 2dbd426ee..9fb3200a7 100644 --- a/back/methods/account/specs/change-password.spec.js +++ b/back/methods/account/specs/change-password.spec.js @@ -2,9 +2,11 @@ const {models} = require('vn-loopback/server/server'); fdescribe('account changePassword()', () => { it('should throw an error when old password is wrong', async() => { - const response = models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999'); + let err; + await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999') + .catch(error => err = error.sqlMessage); - const error = new Error('ER_SIGNAL_EXCEPTION: Invalid password'); - await expectAsync(response).toBeRejectedWith(error); + expect(err).toBeDefined(); + expect(err).toEqual('Invalid password'); }); });