How to write unit testing using karma jasmine

36 Views Asked by At
export class Helperservice{
   
  showDialog(data: any): void {
    $(document).trigger('openDialog', data);
  }

  hideDialog(): void {
    $(document).trigger('closeDialog');
  }

}
//Usage


helper.showDialog({
  name: 'termsandcondition',
  data: {
            title:'title',
            message:'Message',
            callback: () => {
              helper.hideDialog();
            }
          }
});

how to write unit testing above given code using jasmine karma helper service have two method i will call helper.dialog method with parameter passing that params have json type and also have callback function inside another function called helper.hideDialog.

i am writing unit testing for helper.showDialog but i cant achieve inside of callback in helper.hideDialog function if any person know kindly post your suggestion

0

There are 0 best solutions below