From 8283583807372c2951499217ded56be34afa3e8a Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 11 Mar 2019 10:12:07 -0300 Subject: [PATCH] Fix goToEvents spec by mocking #isMobileScreen --- .../institution/institutionControllerSpec.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/frontend/test/specs/institution/institutionControllerSpec.js b/frontend/test/specs/institution/institutionControllerSpec.js index 2257256d9..d6e5efeec 100644 --- a/frontend/test/specs/institution/institutionControllerSpec.js +++ b/frontend/test/specs/institution/institutionControllerSpec.js @@ -255,9 +255,11 @@ expect(institutionService.update).toHaveBeenCalled(); }); }); + describe('goToEvents', function() { - it('should call state.go with the right params', function(){ + it('should call state.go with the INST_EVENTS on desktop', function(){ spyOn(utilsService, 'selectNavOption'); + spyOn(Utils, 'isMobileScreen').and.returnValue(false); institutionCtrl.goToEvents(first_institution.key); expect(utilsService.selectNavOption).toHaveBeenCalledWith( states.INST_EVENTS, @@ -266,7 +268,20 @@ } ); }); + + it('should call state.go with the EVENTS on mobile', function(){ + spyOn(utilsService, 'selectNavOption'); + spyOn(Utils, 'isMobileScreen').and.returnValue(true); + institutionCtrl.goToEvents(first_institution.key); + expect(utilsService.selectNavOption).toHaveBeenCalledWith( + states.EVENTS, + { + institutionKey: first_institution.key, + } + ); + }); }); + describe('goToLinks()', function() { it('should call state.go', function() { spyOn(state, 'go');