updated unit tests
gitea/salix/2127-sample_disable_preview This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-02-26 14:45:47 +01:00
parent d66c53dbf2
commit 1d326a52c8
1 changed files with 13 additions and 4 deletions

View File

@ -107,7 +107,7 @@ describe('Client', () => {
expect(controller.$http.get).not.toHaveBeenCalled();
});
it(`should perform an HTTP query without passing companyId param`, () => {
it(`should perform an HTTP query without passing companyFk param`, () => {
controller.$.sampleType.selection = {
hasCompany: false,
code: 'MyReport'
@ -116,25 +116,34 @@ describe('Client', () => {
clientId: 101,
recipient: 'client@email.com'
};
const expectedParams = {
clientId: 101,
recipient: 'client@email.com'
};
const serializedParams = $httpParamSerializer(expectedParams);
const serializedParams = $httpParamSerializer(controller.clientSample);
$httpBackend.expect('GET', `email/MyReport?${serializedParams}`).respond(true);
controller.send(false, () => {});
$httpBackend.flush();
});
it(`should perform an HTTP query passing companyId param`, () => {
it(`should perform an HTTP query passing companyFk param`, () => {
controller.$.sampleType.selection = {
hasCompany: true,
code: 'MyReport'
};
controller.clientSample = {
clientId: 101,
recipient: 'client@email.com',
companyFk: 442
};
const expectedParams = {
clientId: 101,
recipient: 'client@email.com',
companyId: 442
};
const serializedParams = $httpParamSerializer(expectedParams);
const serializedParams = $httpParamSerializer(controller.clientSample);
$httpBackend.expect('GET', `email/MyReport?${serializedParams}`).respond(true);
controller.send(false, () => {});
$httpBackend.flush();