How to mock <Wrapper /> ?

オープン
#656 コメント 5 件 リアクション 4 件 担当者 1 名 GitHub で見る

@wangela がすでに取り組んでいます。

2023年4月21日 から。

評価

この issue はまだ評価されていません。

説明

type: question

Hey,

I am completely lost on unit testing using Jest.

Basically, does anyone know how to mock in order to render child component in unit tests?

const MyApp = () => (
  <Wrapper apiKey={"YOUR_API_KEY"}>
    <MyMapComponent />
  </Wrapper>
);

The thing is, always have Status of loading, and it never goes to Success, so the child component is never rendered. Is there a way to mock that Status to Success?

I'm using jest, and react-testing-library.

Thank you.

主要言語
TypeScript
スター
381
フォーク
50
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

googlemaps/react-wrapper のほかの issue

googlemaps/react-wrapper の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。