diff --git a/e2e/paths/05-ticket/18_index_payout.spec.js b/e2e/paths/05-ticket/18_index_payout.spec.js index 89b5937a1..220dacf61 100644 --- a/e2e/paths/05-ticket/18_index_payout.spec.js +++ b/e2e/paths/05-ticket/18_index_payout.spec.js @@ -63,6 +63,6 @@ describe('Ticket index payout path', () => { const reference = await page.waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText'); expect(count).toEqual(4); - expect(reference).toContain('Cash,Albaran: 7, 8Payment'); + expect(reference).toContain('Cash, Albaran: 7, 8Payment'); }); }); diff --git a/loopback/common/methods/application/post.js b/loopback/common/methods/application/post.js index 9ea9a7f71..739f1341a 100644 --- a/loopback/common/methods/application/post.js +++ b/loopback/common/methods/application/post.js @@ -12,6 +12,7 @@ module.exports = Self => { }); Self.post = async ctx => { + console.log(ctx.req.body); return ctx.req.body; }; }; diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index ef22c968a..cc9e1ab5a 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -68,7 +68,7 @@ class Controller extends Dialog { this.receipt.description.push(accountingType.receiptDescription); if (this.originalDescription) this.receipt.description.push(this.originalDescription); - this.receipt.description.join(', '); + this.receipt.description = this.receipt.description.join(', '); } this.maxAmount = accountingType && accountingType.maxAmount; diff --git a/modules/client/front/balance/create/index.spec.js b/modules/client/front/balance/create/index.spec.js index 408e6b66a..fa6b48ea4 100644 --- a/modules/client/front/balance/create/index.spec.js +++ b/modules/client/front/balance/create/index.spec.js @@ -38,7 +38,7 @@ describe('Client', () => { } }; - expect(controller.receipt.description.join(',')).toEqual('Cash,Albaran: 1, 2'); + expect(controller.receipt.description).toEqual('Cash, Albaran: 1, 2'); }); }); diff --git a/modules/client/front/sample/create/index.js b/modules/client/front/sample/create/index.js index 13ef875da..b25bf7919 100644 --- a/modules/client/front/sample/create/index.js +++ b/modules/client/front/sample/create/index.js @@ -5,10 +5,6 @@ import './style.scss'; class Controller extends Section { constructor($element, $, vnEmail) { super($element, $); - this.clientSample = { - clientFk: this.$params.id, - companyId: this.vnConfig.companyFk - }; this.vnEmail = vnEmail; } @@ -19,10 +15,8 @@ class Controller extends Section { set client(value) { this._client = value; - if (value) { - this.clientSample.recipient = value.email; - this.getWorkerEmail(); - } + if (value) + this.setClientSample(value); } get companyId() { @@ -119,12 +113,17 @@ class Controller extends Section { .then(() => this.$state.go('client.card.sample.index')); } - getWorkerEmail() { + setClientSample(client) { const userId = window.localStorage.currentUserWorkerId; const params = {filter: {where: {userFk: userId}}}; this.$http.get('EmailUsers', params).then(res => { const [worker] = res && res.data; - this.clientSample.replyTo = worker.email; + this.clientSample = { + clientFk: this.$params.id, + companyId: this.vnConfig.companyFk, + recipient: client.email, + replyTo: worker.email + }; }); } } diff --git a/modules/client/front/sample/create/index.spec.js b/modules/client/front/sample/create/index.spec.js index 8e33a1075..ecaf038fa 100644 --- a/modules/client/front/sample/create/index.spec.js +++ b/modules/client/front/sample/create/index.spec.js @@ -191,15 +191,19 @@ describe('Client', () => { }); }); - describe('getWorkerEmail()', () => { + describe('setClientSample()', () => { it(`should perform a query and then set the replyTo property to the clientSample object`, () => { + const client = {email: 'test@example.com'}; const expectedEmail = 'batman@arkhamcity.com'; const serializedParams = $httpParamSerializer({filter: {where: {}}}); $httpBackend.expect('GET', `EmailUsers?${serializedParams}`).respond([{email: expectedEmail}]); - controller.getWorkerEmail(); + controller.setClientSample(client); $httpBackend.flush(); expect(controller.clientSample.replyTo).toEqual(expectedEmail); + expect(controller.clientSample.clientFk).toEqual(controller.$params.id); + expect(controller.clientSample.recipient).toEqual(client.email); + expect(controller.clientSample.companyId).toEqual(controller.vnConfig.companyFk); }); }); });