Merge branch 'dev' into 5168-mostrar-instanceLog
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2023-02-24 08:08:20 +00:00
commit 4682497df9
6 changed files with 19 additions and 15 deletions

View File

@ -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');
});
});

View File

@ -12,6 +12,7 @@ module.exports = Self => {
});
Self.post = async ctx => {
console.log(ctx.req.body);
return ctx.req.body;
};
};

View File

@ -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;

View File

@ -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');
});
});

View File

@ -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
};
});
}
}

View File

@ -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);
});
});
});