angular / angular/angularfire

[docs] Mocking of angularfire methods with angularfire 7 during tests

Aperta
#3,050 4 commenti 9 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
7.8k
Fork
2.2k
Merge medio
22h 28m
PR unite (30g)
6

Descrizione

### Version info

**Angular:** 12

**Firebase:** 9

**AngularFire:** 7

### How to reproduce these conditions

How to mock firebase operator during tests suits ?
How to write unit tests with mocks of firestore/auth/analytics methods ?

### Expected behavior

With Angularfire 6, I was able to mock angularfire methods like doc, collection and other methods to write my unit tests.
I would like to be able to mock it.

### Actual behavior

I am getting the error during my unit tests :
Error: Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using provideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con la configurazione dei test di AngularFire 7 relativa a AngularFireModule e provideFirebaseApp, quindi riproduci l’errore di unit test segnalato facendo il mock dei metodi di Firestore, Auth e Analytics. Il lavoro è completato quando viene documentata una guida funzionante per fare il mock di questi metodi di AngularFire con Angular 12, Firebase 9 e AngularFire 7.

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

Valutazione

Stack tecnologico
angular, firebase, typescript
Ambito
documentation, testing
Tipo di issue
Documentazione
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.