Closed marickmanrho closed 4 years ago
This should be a quick fix.
Well, how to spy on the alert itself?
Now we have in register.page.ts
private async showSafetyAlert() {
const alert = await this.alertCtrl.create({
header: "Warning",
subHeader: "Password Safety",
message: "This app is in Alpha and therefore we cannot guarantee the safety of your data. Please keep this in mind when picking your password. We recommend you pick a password you do not use anywhere else.",
buttons: ["Accept"],
backdropDismiss: false
});
await alert.present();
}
and in register.page.spec.ts
let alertSpy: AlertController = jasmine.createSpyObj("alertSpy", ["create", "dismiss"]);
But how to spy on the present()
method created by the create
method of the alertSpy?
Ah I see your point. Well we control what create returns, we can make the create function return an object that has a present
method.
The
present
method is not included in the AlertSpy object causing a late security error.Copy of error: