我是茉莉花的新手,我需要为以下代码编写代码覆盖率:
spyOn(company.LoginData,'isUserLogged').and.returnValue(true);
如何在jasmine测试用例中覆盖customerAddress和regionCode变量?
var regionCode = company.Utils.getRegionCodeFromMapping(company.regionFromPagePath.toUpperCase());
// In case the user is logged in.
if (company.LoginData.isUserLogged()) {
var customer = company.LoginData.data.userProfile.customer;
var customerAddress = !_.isUndefined(customer.address[0]) ? customer.address[0] : customer.address;
regionCode = customerAddress.countryName.code;
}