I am learning to write unit tests in ionic and am unable to write a test for AlertController. Below attached is the code
async BackupSQL() {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'BACKUP',
message: 'Are you sure want to backup data?',
buttons: [
{
text: 'Cancel',
role: 'cancel',
cssClass: 'secondary',
handler: (blah) => {
}
}, {
text: 'OK',
handler: (data) => {
this.exportToSQL();
}
}
]
});
await alert.present();
}
please help me to find solutions for handler event in unit test case coverage. Would really appreciate it if someone could help me write test case to cover the alert button actions and present. Thanks in advance
1 post - 1 participant