-2
I don’t understand how I could test this function of Component, I’ve tried some ways, but I really didn’t understand how to do
Function in the Component:
openModal(){
if(this.RecommendationCount >= this.amount && this.isEnabled){
this.ModalIndicationService.setInfos(this.image, this.description,this.id,this.card, this.user,this.title);
this.ModalIndicationService.postInfos(this.RecommendationCount);
this.ModalIndicationService.amountInfos(this.amount);
this.modalRef = this.modalService.show(ModalIndicationComponent,{class:'modal-lg modal-dialog-centered'});
}
Function in the spec.ts
it('open modal test values true', (done) => {
cardIndicationComponent.RecommendationCount = 10
cardIndicationComponent.amount = 5
cardIndicationComponent.isEnabled = true
modalIndicationService.linkPhoto = 'first parameter';
modalIndicationService.description = 'second parameter';
modalIndicationService.idCard = 'third parameter';
modalIndicationService.CardReward = 1;
modalIndicationService.user = 2;
modalIndicationService.title = 'fourth parameter'
cardIndicationComponent.openModal()
expect(cardIndicationComponent.openModal()).toBe()
});