diff --git a/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js b/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js index 9c2409124..de07dd780 100644 --- a/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js +++ b/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.js @@ -135,10 +135,6 @@ module.exports = Self => { newRefundTicket.id, claim.ticketFk ], {transaction: transaction}); - let claimState = await Self.app.models.ClaimState.findOne({where: {description: 'Resuelto'}}); - - await claim.updateAttribute('claimStateFk', claimState.id, {transaction: transaction}); - await transaction.commit(); return newRefundTicket; diff --git a/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.spec.js b/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.spec.js index e76bf608a..b7f961b13 100644 --- a/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.spec.js +++ b/modules/claim/back/methods/claim-beginning/importToNewRefundTicket.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -// xcluded waiting for fixtures -xdescribe('claimBeginning', () => { + +describe('claimBeginning', () => { let ticket; let refundTicketObservations; let refundTicketSales; diff --git a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js index 84b9113ac..d838bc907 100644 --- a/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/regularizeClaim.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -// xcluded waiting for fixtures -xdescribe('regularizeClaim()', () => { + +describe('regularizeClaim()', () => { const claimFk = 1; const pendentState = 1; const resolvedState = 3; diff --git a/modules/client/back/methods/client/specs/getDebt.spec.js b/modules/client/back/methods/client/specs/getDebt.spec.js index 19f7cd485..b69ae8624 100644 --- a/modules/client/back/methods/client/specs/getDebt.spec.js +++ b/modules/client/back/methods/client/specs/getDebt.spec.js @@ -1,10 +1,10 @@ const app = require('vn-loopback/server/server'); -xdescribe('client getDebt()', () => { - it('should return the client debt', async () => { +describe('client getDebt()', () => { + it('should return the client debt', async() => { let result = await app.models.Client.getDebt(101); - expect(result.debt).toEqual(579.1); + expect(result.debt).toEqual(329.13); }); }); diff --git a/modules/order/front/create/card.spec.js b/modules/order/front/create/card.spec.js index 93e822595..635fa26f5 100644 --- a/modules/order/front/create/card.spec.js +++ b/modules/order/front/create/card.spec.js @@ -1,6 +1,6 @@ import './card.js'; -xdescribe('Order', () => { +describe('Order', () => { describe('Component vnOrderCreateCard', () => { let controller; let $httpBackend; @@ -22,11 +22,30 @@ xdescribe('Order', () => { }); describe('set clientFk', () => { - it(`should set addressFk to null and clientFk to a value`, () => { + it(`should set addressFk to null and clientFk to a value and set addressFk to a value given`, () => { + let filter = { + include: { + relation: 'defaultAddress', + scope: { + fields: 'id' + } + }, + where: {id: 2} + }; + filter = encodeURIComponent(JSON.stringify(filter)); + let response = [ + { + defaultAddress: {id: 1} + } + ]; + $httpBackend.whenGET(`/api/Clients?filter=${filter}`).respond(response); + $httpBackend.expectGET(`/api/Clients?filter=${filter}`); + controller.clientFk = 2; + $httpBackend.flush(); expect(controller.clientFk).toEqual(2); - expect(controller.order.addressFk).toBe(null); + expect(controller.order.addressFk).toBe(1); }); }); diff --git a/modules/order/front/line/index.spec.js b/modules/order/front/line/index.spec.js index cfa57c231..0c56dd233 100644 --- a/modules/order/front/line/index.spec.js +++ b/modules/order/front/line/index.spec.js @@ -1,6 +1,7 @@ import './index.js'; +import watcher from 'core/mocks/watcher'; -xdescribe('Order', () => { +describe('Order', () => { describe('Component vnOrderLine', () => { let $state; let controller; @@ -14,6 +15,7 @@ xdescribe('Order', () => { $httpBackend = _$httpBackend_; controller = $componentController('vnOrderLine', {$state}); controller.rows = [{id: 1}]; + controller.$scope.watcher = watcher; controller.$scope.popover = {relocate: () => {}}; controller.$scope.descriptor = {show: () => {}}; controller.vnApp = {showSuccess: () => {}}; @@ -50,14 +52,16 @@ xdescribe('Order', () => { expect(controller.rows.length).toBe(1); spyOn(controller.vnApp, 'showSuccess'); spyOn(controller, 'getVAT'); + spyOn(controller.card, 'reload'); controller.deleteRow('ACCEPT'); $httpBackend.expectPOST(`/order/api/OrderRows/removes`).respond(); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.card.reload).toHaveBeenCalledWith(); expect(controller.rows.length).toBe(0); - expect(controller.idsToRemove).toBe(undefined); + expect(controller.lineIdToRemove).toBe(undefined); }); });