firebase / firebase/quickstart-testing

typescript please!

Aperta
#107 5 commenti 5 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
368
Fork
125
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Desperately needing samples in TypeScript. I'm trying to test functions now and don't have a clue what parameters are possible on Request and Response objects. Have Googled for hours and can't find what I need. Would love to see some really basic function tests in Mocha and Typescript against the emulator. Tests for...

HTTP
If function is supposed to return an uppercase version of what is passed in, check that
Function grabs parameters out of the query string
If function is supposed to return an error code, like forbidden, show that
If function is supposed to write to a document
Fail if not authenticated, return proper status code
Check claims, fail if not met

INTERNAL SERVER
On user create, create a document
On user delete, delete a document
On document changes, do something

===

Digging through your code a bit I see references to "core" and Express. Can I even get these types into my code? I'd like to strongly type my request and response objects. Where do I import these from?

===

Investigated some more and see it is Express web server under the covers? I'm going to assume that testing this in Typescript is going to be tough because there are so many possible properties on the Request object - headers and such - and so many ways to build the response and I'd need test helpers to construct these things in such a way that they'd type check. Also don't know how this interacts with the Auth stuff - do I get the token from the headers or from the Auth API. This is really beyond me - too much to learn - probably will just skip the unit testing. Can't do it without some getting started info from you with common cases in code.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

La issue richiede esempi in TypeScript e Mocha per funzioni HTTP e funzioni del server interno basate sull’emulatore, comprese l’autenticazione e le operazioni sui documenti. Inizia individuando gli esempi esistenti di test dell’emulatore e determinando come vengono esposti i tipi Request e Response; il lavoro è completo quando sono disponibili esempi eseguibili per iniziare che coprano i casi elencati.

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

Valutazione

Stack tecnologico
express, firebase, javascript, typescript
Ambito
backend, documentation, testing
Tipo di issue
Documentazione
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
20/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.