I am using jasmine to write a unit test in angular. The method uses the the window.navigator property. The property is defined outside the method like below
declare var navigator: any;
navigator = window.navigator;
In the method to be tested the below code is present which is to be tested
let locale = navigator.language || navigator.userLanguage || navigator.browserLanguage;
The first condition navigator.language
gets covered automatically while running the unit test.
I want to cover all branches of this code ie, I want to cover all OR conditions while testing. How do I mock the navigator in unit test?