Skip to content

Commit

Permalink
Fix goToEvents spec by mocking #isMobileScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
brobsc committed Mar 11, 2019
1 parent db4c5e0 commit 8283583
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion frontend/test/specs/institution/institutionControllerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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');
Expand Down

0 comments on commit 8283583

Please sign in to comment.