Integration Tests Not Properly Mocked
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- graphql, node.js, typescript
Direzione di ricerca
Inizia eseguendo i test di integrazione con la rete disabilitata e ispeziona l’esempio che assegna launchAPI.get, quindi traccia quale metodo di RESTDataSource gestisce la ricerca del lancio. L’issue non indica file né comandi di test; il lavoro è completato quando i test di integrazione passano offline senza richiedere api.spacexdata.com e continuano a restituire i dati attesi del razzo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I followed the integration tests example pattern in my own app.
// mock the datasources' underlying fetch methods, whether that's a REST
// lookup in the RESTDataSource or the store query in the Sequelize datasource
launchAPI.get = jest.fn(() => [mockLaunchResponse]);
However I noticed it was still making api calls to the rest endpoint. I then cloned this repo turned off my wifi and ran the integration tests and sure enough I got an error.
errors": Array [
+ Object {
+ "extensions": Object {
+ "code": "INTERNAL_SERVER_ERROR",
+ "exception": Object {
+ "code": "ENOTFOUND",
+ "errno": "ENOTFOUND",
+ "message": "request to https://api.spacexdata.com/v2/launches?flight_number=30 failed, reason: getaddrinfo ENOTFOUND api.spacexdata.com api.spacexdata.com:443",
+ "type": "system",
+ },
},
- "rocket": Object {
- "type": "FT",
- },
+ "locations": Array [
+ Object {
+ "column": 3,
+ "line": 2,
+ },
+ ],
+ "message": "request to https://api.spacexdata.com/v2/launches?flight_number=30 failed, reason: getaddrinfo ENOTFOUND api.spacexdata.com api.spacexdata.com:443",
+ "path": Array [
+ "launch",
+ ],
This tells me that launchAPI.get is not being properly mocked. Which I think would make sense as there is no launchAPI.get however there is a launchAPI.prototype.get however that doesn't seem to work when I change the tests to that.
Any ideas?
- Lingua principale
- TypeScript
- Stelle
- 1.2k
- Fork
- 808
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apollographql/fullstack-tutorial
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
investigate
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
tutorial links are broken Apertadocumentation
apollographql/fullstack-tutorial#285 · 3 commenti · 1 assegnatario ·
-
investigate
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
apollographql/fullstack-tutorial#255 · 2 reazioni ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
apollographql/fullstack-tutorial#254 · 2 commenti ·
Tutte le issue di apollographql/fullstack-tutorial
Issue simili
-
blocklist removal
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
pastelsky/bundlephobia#1122 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100