Updated unit test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-04-07 14:14:31 +02:00
parent 465955d0c5
commit 418d7a2d12
2 changed files with 15 additions and 3 deletions

View File

@ -9,8 +9,6 @@ class Controller extends Section {
clientFk: this.$params.id, clientFk: this.$params.id,
companyId: this.vnConfig.companyFk companyId: this.vnConfig.companyFk
}; };
this.getWorkerEmail();
} }
get client() { get client() {
@ -20,8 +18,10 @@ class Controller extends Section {
set client(value) { set client(value) {
this._client = value; this._client = value;
if (value) if (value) {
this.clientSample.recipient = value.email; this.clientSample.recipient = value.email;
this.getWorkerEmail();
}
} }
get companyId() { get companyId() {

View File

@ -179,5 +179,17 @@ describe('Client', () => {
expect(controller.$state.go).toHaveBeenCalledWith('client.card.sample.index'); expect(controller.$state.go).toHaveBeenCalledWith('client.card.sample.index');
}); });
}); });
describe('getWorkerEmail()', () => {
it(`should perform a query and then set the replyTo property to the clientSample object`, () => {
const expectedEmail = 'batman@arkhamcity.com';
const serializedParams = $httpParamSerializer({filter: {where: {}}});
$httpBackend.expect('GET', `EmailUsers?${serializedParams}`).respond([{email: expectedEmail}]);
controller.getWorkerEmail();
$httpBackend.flush();
expect(controller.clientSample.replyTo).toEqual(expectedEmail);
});
});
}); });
}); });