updated unit tests
gitea/salix/2127-sample_disable_preview This commit looks good
Details
gitea/salix/2127-sample_disable_preview This commit looks good
Details
This commit is contained in:
parent
d66c53dbf2
commit
1d326a52c8
|
@ -107,7 +107,7 @@ describe('Client', () => {
|
||||||
expect(controller.$http.get).not.toHaveBeenCalled();
|
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 = {
|
controller.$.sampleType.selection = {
|
||||||
hasCompany: false,
|
hasCompany: false,
|
||||||
code: 'MyReport'
|
code: 'MyReport'
|
||||||
|
@ -116,25 +116,34 @@ describe('Client', () => {
|
||||||
clientId: 101,
|
clientId: 101,
|
||||||
recipient: 'client@email.com'
|
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);
|
$httpBackend.expect('GET', `email/MyReport?${serializedParams}`).respond(true);
|
||||||
controller.send(false, () => {});
|
controller.send(false, () => {});
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should perform an HTTP query passing companyId param`, () => {
|
it(`should perform an HTTP query passing companyFk param`, () => {
|
||||||
controller.$.sampleType.selection = {
|
controller.$.sampleType.selection = {
|
||||||
hasCompany: true,
|
hasCompany: true,
|
||||||
code: 'MyReport'
|
code: 'MyReport'
|
||||||
};
|
};
|
||||||
controller.clientSample = {
|
controller.clientSample = {
|
||||||
|
clientId: 101,
|
||||||
|
recipient: 'client@email.com',
|
||||||
|
companyFk: 442
|
||||||
|
};
|
||||||
|
const expectedParams = {
|
||||||
clientId: 101,
|
clientId: 101,
|
||||||
recipient: 'client@email.com',
|
recipient: 'client@email.com',
|
||||||
companyId: 442
|
companyId: 442
|
||||||
};
|
};
|
||||||
|
const serializedParams = $httpParamSerializer(expectedParams);
|
||||||
|
|
||||||
const serializedParams = $httpParamSerializer(controller.clientSample);
|
|
||||||
$httpBackend.expect('GET', `email/MyReport?${serializedParams}`).respond(true);
|
$httpBackend.expect('GET', `email/MyReport?${serializedParams}`).respond(true);
|
||||||
controller.send(false, () => {});
|
controller.send(false, () => {});
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
Loading…
Reference in New Issue