I have a list of components, some of them come with the property "factor" and others comes with the property "quickpay".
I created a couple getters for them:
get hasFactor(): boolean {
return this.load.factor;
}
get hasQuickpay(): boolean {
return this.load.quickpay;
}
and then created a function that among other things opens a certain URL depending on if "factor" or "quickpay" is true
(if one of them is true
the other is false
).
visitPage(){
if(this.hasFactor){
this.trackLink(SearchSharedTracking.goToFactor,this.Factor);
window.open('https://www.spacepln.com/factor/ ','_blank');
}else{
this.trackLink(SearchSharedTracking.goToQuickpay,this.Quickpay);
window.open('https://www.spacepln.com/quickpay','_blank');
}
}
In my .spect file, I have to test using Karma - Jasmine whether the factor page was opened or quickpay was opened. I'm stuck and don't know how to write a unit test for that.