Reto:
it('Should show error with an email invalid', fakeAsync(() => {
const inputDebug = query(fixture, 'input#email');
const inputEl: HTMLInputElement = inputDebug.nativeElement;
inputEl.value = "[email protected]"
userService.isAvailableByEmail.and.returnValue(mockObservable({isAvailable: false}));
tick();
inputEl.dispatchEvent(new Event('input'));
inputEl.dispatchEvent(new Event('blur'));
fixture.detectChanges();
const textError = getText(fixture, 'email-error-async');
expect(component.emailField?.invalid).toBeTrue();
expect(userService.isAvailableByEmail).toHaveBeenCalledWith("[email protected]");
expect(textError).toContain('*The email is already registered')
}))
¿Quieres ver más aportes, preguntas y respuestas de la comunidad?