Testing of a component function

Asked

Viewed 14 times

-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()
  });

1 answer

0

I understood later how to do, I’m testing face parameter, if all the parameters are correct, soon the function will work

Browser other questions tagged

You are not signed in. Login or sign up in order to post.