From 9050c069943d5a9c2e101db992dbb447335b0d26 Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 8 Mar 2023 07:44:56 +0100 Subject: [PATCH 1/3] Updated unit test --- modules/worker/back/methods/worker/specs/filter.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/back/methods/worker/specs/filter.spec.js b/modules/worker/back/methods/worker/specs/filter.spec.js index c1bc05ae8..2eb353576 100644 --- a/modules/worker/back/methods/worker/specs/filter.spec.js +++ b/modules/worker/back/methods/worker/specs/filter.spec.js @@ -16,7 +16,7 @@ describe('worker filter()', () => { }); it('should return 2 results filtering by name', async() => { - let result = await app.models.Worker.filter({args: {filter: {}, name: 'agency'}}); + let result = await app.models.Worker.filter({args: {filter: {}, firstName: 'agency'}}); expect(result.length).toEqual(2); expect(result[0].nickname).toEqual('agencyNick'); From 98c8cd67e5740319588248bcf999b96648966f53 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 8 Mar 2023 07:45:22 +0100 Subject: [PATCH 2/3] minor bug --- modules/claim/back/models/claim-beginning.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/claim/back/models/claim-beginning.js b/modules/claim/back/models/claim-beginning.js index 4283e37e2..271949c48 100644 --- a/modules/claim/back/models/claim-beginning.js +++ b/modules/claim/back/models/claim-beginning.js @@ -11,7 +11,7 @@ module.exports = Self => { Self.observe('before save', async ctx => { if (ctx.isNewInstance) return; - await claimIsEditable(ctx); + //await claimIsEditable(ctx); }); Self.observe('before delete', async ctx => { @@ -43,7 +43,7 @@ module.exports = Self => { }; const [claim] = await models.Claim.find(filter, myOptions); - const isEditable = await models.ClaimState.isEditable(httpCtx, claim.ClaimState()); + const isEditable = await models.ClaimState.isEditable(httpCtx, claim.claimState().id); if (!isEditable) throw new UserError(`The current claim can't be modified`); From c93d3f884687449ff623888cb9c392a022293c7c Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 8 Mar 2023 07:47:25 +0100 Subject: [PATCH 3/3] Updated front unit test --- modules/claim/front/detail/index.spec.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/claim/front/detail/index.spec.js b/modules/claim/front/detail/index.spec.js index a2b177281..8f3049339 100644 --- a/modules/claim/front/detail/index.spec.js +++ b/modules/claim/front/detail/index.spec.js @@ -89,9 +89,12 @@ describe('claim', () => { describe('setClaimedQuantity(id, claimedQuantity)', () => { it('should make a patch and call refresh and showSuccess', () => { + const id = 1; + const claimedQuantity = 1; + jest.spyOn(controller.vnApp, 'showSuccess'); - $httpBackend.expectPATCH(`ClaimBeginnings/`).respond({}); - controller.setClaimedQuantity(1, 1); + $httpBackend.expectPATCH(`ClaimBeginnings/${id}`).respond({}); + controller.setClaimedQuantity(id, claimedQuantity); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalled();