FirebaseError when using fakeAsync
- Linguagem predominante
- TypeScript
- Estrelas
- 7.8k
- Forks
- 2.2k
- Merge médio
- 22h 28min
- PRs com merge (30d)
- 6
Descrição
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
Guia de contribuição
Direção de pesquisa
Comece com o código recover-email fornecido e seu teste fakeAsync; em seguida, inspecione como recoverEmail$ chega a Firebase Auth checkActionCode enquanto o emulador localhost está em execução. Reproduza a falha com tick(600) e flush(); concluído significa que o teste é concluído com sucesso sob fakeAsync, sem auth/network-request-failed.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- angular, firebase, typescript
- Domínio
- authentication, testing
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100