From a86c7c9b8a6b1bbbdd3328f07fff1857710be4da Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 26 Feb 2020 14:45:47 +0100 Subject: [PATCH] updated unit tests --- .../client/front/sample/create/index.spec.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/client/front/sample/create/index.spec.js b/modules/client/front/sample/create/index.spec.js index da9a557f1..d3817a439 100644 --- a/modules/client/front/sample/create/index.spec.js +++ b/modules/client/front/sample/create/index.spec.js @@ -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();