angular / angular/angularfire

FirebaseError when using fakeAsync

Abierto
#3,615 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
7.8k
Forks
2.2k
Merge medio
22 h 28 min
PR fusionados (30 d)
6

Descripción

I'm seeing `Firebase: Error (auth/network-request-failed)` when using `fakeAsync`, but success without using it. (While using the emulator on localhost during test runs.)

```ts
it('should recover email fakeAsync', fakeAsync((): void => {
console.log('START');
service.recoverEmail$(testOobCode).subscribe({
error: fail,
next: (data: RecoverEmailResults): void => {
expect(data).withContext('RecoverEmailResults').toEqual({
passwordResetSent: true,
restoredEmail: testOriginalEmail,
successful: true,
});
},
});

tick(600);
flush(); // Makes the promises actually settle within the test lifetime.
console.log('END');
}));
```
`recoverEmail$` is calling `checkActionCode` (and `applyActionCode`, but it doesn't get there) from Firebase. (`@angular/fire/auth` wrappers, current 19.0.0 version). Best I can tell firebase just uses browser `fetch`, but I cannot find any reports of problems with `fakeAsync` and `fetch` (possibly due to the commonness of the word `fetch` in code discussions).

Full code is here: https://github.com/rgant/brainfry/tree/main/src/app/identity/recover-email

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con el código recover-email proporcionado y su prueba fakeAsync; después, inspecciona cómo recoverEmail$ llega a Firebase Auth checkActionCode mientras el emulador de localhost está en ejecución. Reproduce el fallo con tick(600) y flush(); terminado significa que la prueba se completa correctamente con fakeAsync sin auth/network-request-failed.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, firebase, typescript
Área
authentication, testing
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.