diff options
Diffstat (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal-request.controller.test.js')
-rw-r--r-- | vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal-request.controller.test.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal-request.controller.test.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal-request.controller.test.js index 87edca319..b62d5e117 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal-request.controller.test.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal-request.controller.test.js @@ -22,6 +22,8 @@ require('./report-modal-request.controller'); const jestMock = require('jest-mock'); describe('Testing error report creation', () => { + const mockAPI = "testAPI"; + let $notNeeded; let $controller; @@ -31,6 +33,7 @@ describe('Testing error report creation', () => { let mockWindow; let mockReportService; let testErrorMsg; + let mockDataService; let correctResponse; let failResponse; @@ -44,6 +47,11 @@ describe('Testing error report creation', () => { beforeEach(inject(function (_$controller_) { $notNeeded = jestMock.fn(); mockHttp = jestMock.fn(); + mockDataService = jestMock.fn(); + + mockDataService.getMsoRequestParametersTestApi = function() { + return mockAPI; + }; mockModalInstance = {}; mockWindow = { @@ -74,6 +82,7 @@ describe('Testing error report creation', () => { $scope: $notNeeded, $window: mockWindow, ReportService: mockReportService, + DataService: mockDataService, errorMsg: testErrorMsg, requestInfo: mockInfo }); @@ -91,7 +100,10 @@ describe('Testing error report creation', () => { $controller.saveReportData(correctResponse); - expect($controller.report).toEqual(testErrorMsg + "\n\n Collected data from API:\n" + JSON.stringify(correctResponse.data, null, "\t")); + expect($controller.report).toEqual( + "Selected test API: \n" + mockAPI + + "\n\n Data from GUI:\n" + testErrorMsg + + "\n\n Collected data from API:\n" + JSON.stringify(correctResponse.data, null, "\t")); expect($controller.downloadEnable).toBeTruthy(); expect($controller.download).toEqual(new Blob([ $controller.report ], { type : 'text/plain' })); }); |