Integration Tests Not Properly Mocked
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- graphql, node.js, typescript
調査の方向性
まずネットワークを無効にして統合テストを実行し、launchAPI.get を割り当てている例を調べてから、打ち上げの検索を処理する RESTDataSource メソッドを追跡します。issue ではファイル名もテストコマンドも指定されていません。統合テストがオフラインで、api.spacexdata.com にリクエストせずに成功し、期待されるロケットデータを引き続き返せれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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?
- 主要言語
- TypeScript
- スター
- 1.2k
- フォーク
- 808
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apollographql/fullstack-tutorial のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
investigate
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
-
documentation
apollographql/fullstack-tutorial#285 · コメント 3 件 · 担当者 1 名 ·
-
investigate
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
apollographql/fullstack-tutorial#255 · リアクション 2 件 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
apollographql/fullstack-tutorial#254 · コメント 2 件 ·
apollographql/fullstack-tutorial の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug v2
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
modelcontextprotocol/inspector#2458 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
carbon-design-system/ibm-products#9907 ·