Angular - mock Promise method for Jasmine unit test
问题 Method to test public onSubmit(registerData: RegisterDataModel): void { this.registrationService.registerWithEmailAndPassword(registerData).then((msg: string[]) => this.router.navigate(['/completeSignUp']).then(() => { msg.forEach(singleMessage => this.notificationService.primary(singleMessage)); })) .catch((msg) => msg.forEach(singleMessage => { this.notificationService.danger(singleMessage); })); } I want to test if router.navigate is called in my method. Now I want to mock my service