From e214da96b851621b579cc10c2711da2606443a93 Mon Sep 17 00:00:00 2001 From: Keerthi Sai Maganti <99385461+keerthi-magantii@users.noreply.github.com> Date: Fri, 28 Jun 2024 16:59:55 +0530 Subject: [PATCH] Radhakrishna, Keerthi | MOBN-2408 | add. mockAppDescriptor in visitController test file (#82) --- .../controllers/visitController.spec.js | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/ui/test/unit/clinical/common/controllers/visitController.spec.js b/ui/test/unit/clinical/common/controllers/visitController.spec.js index 1107faf921..a413cfb716 100644 --- a/ui/test/unit/clinical/common/controllers/visitController.spec.js +++ b/ui/test/unit/clinical/common/controllers/visitController.spec.js @@ -10,6 +10,7 @@ describe('VisitController', function () { var $timeout; var getEncounterPromise; var locationService; + var programConfig; var configurations = { encounterConfig: function () { } @@ -29,7 +30,15 @@ describe('VisitController', function () { } } }; + + var mockAppDescriptor = jasmine.createSpyObj('appDescriptor', ['getConfigValue']); var mockAppService = jasmine.createSpyObj("appService", ["getAppDescriptor"]); + + beforeEach(function() { + mockAppDescriptor.getConfigValue.and.returnValue(programConfig); + mockAppService.getAppDescriptor.and.returnValue(mockAppDescriptor); + }); + beforeEach(module('bahmni.clinical')); beforeEach(module('stateMock')); beforeEach(inject(['$injector', '$timeout', '$q', '$rootScope', '$state', function ($injector, timeout, $q, $rootScope, $state) { @@ -70,20 +79,20 @@ describe('VisitController', function () { }); scope.currentProvider = {uuid: ''}; controller = $controller('VisitController', { - $scope: scope, - $state: state, - encounterService: encounterService, - clinicalAppConfigService: clinicalAppConfigService, - visitSummary: {}, - configurations: configurations, - $timeout: $timeout, - printer: {}, - visitConfig: visitTabConfig, - visitHistory:[], - $stateParams: {}, - locationService: locationService, - appService: mockAppService - }); + $scope: scope, + $state: state, + encounterService: encounterService, + clinicalAppConfigService: clinicalAppConfigService, + visitSummary: {}, + configurations: configurations, + $timeout: $timeout, + printer: {}, + visitConfig: visitTabConfig, + visitHistory:[], + $stateParams: {}, + locationService: locationService, + appService: mockAppService + }); }])); var defaultTab = {