angular / angular/angularfire

FirebaseError when using fakeAsync

Ouverte
#3,615 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
7.8k
Forks
2.2k
Merge moyen
22 h 28 min
PR mergées (30 j)
6

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par le code recover-email fourni et son test fakeAsync, puis examinez comment recoverEmail$ atteint Firebase Auth checkActionCode pendant que l’émulateur localhost est en cours d’exécution. Reproduisez l’échec avec tick(600) et flush(); terminé signifie que le test se termine avec succès sous fakeAsync, sans auth/network-request-failed.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, firebase, typescript
Domaine
authentication, testing
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.