FirebaseError when using fakeAsync

Aperta
#3,615 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
angular, firebase, typescript

Direzione di ricerca

Inizia con il codice recover-email fornito e il relativo test fakeAsync, quindi esamina come recoverEmail$ raggiunge Firebase Auth checkActionCode mentre l’emulatore localhost è in esecuzione. Riproduci il fallimento con tick(600) e flush(); fatto significa che il test viene completato correttamente con fakeAsync senza auth/network-request-failed.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.)

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

Lingua principale
TypeScript
Stelle
7.8k
Fork
2.2k
Merge medio
22h 34m
PR unite (30g)
4

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di angular/angularfire

Tutte le issue di angular/angularfire

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.