renderHook unable to rerender props on the wrapper
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, react
調査の方向性
まず、現在の renderHook wrapper と rerender の動作を、リンク先の react-hooks-testing-library の context の例と比較します。wrapper の props を更新できるか、またはドキュメントに代替方法が必要かを確認します。サポートされる方法、または例を含む明確に文書化された制限があれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Sorry I don't know if I should list this as a bug or as a feature request with the renderHook now being supported react hook testing library. It used to possible to test how context and hooks worked together with react-hooks-testing library - you could render a wrapper with and initial props and then pass new props to the wrapper using rerender.
Here is the example on react hooks testing library site
This was really useful as it allowed you to test how updates from your providers via context could effect the output from your hooks.
To Reproduce Steps to reproduce the behaviour:
This is the implementation as it was on react hooks testing library - I do understand how that how the initial props for the wrapper as changed but I'm using this more to draw attention to how rerender used to work.
import { renderHook, act } from '@testing-library/react-hooks'
import { CounterStepProvider, useCounter } from './counter'
test('should use custom step when incrementing', () => {
const wrapper = ({ children, step }) => (
<CounterStepProvider step={step}>{children}</CounterStepProvider>
)
const { result, rerender } = renderHook(() => useCounter(), {
wrapper,
initialProps: {
step: 2
}
})
act(() => {
result.current.increment()
})
expect(result.current.count).toBe(2)
/**
* For react hook testing library this could be use to update the provider props and therefore affect a hooks return values via context
* in react testing library these values seem to be just passed to the renderHook callback
*/
rerender({ step: 8 })
act(() => {
result.current.increment()
})
expect(result.current.count).toBe(10)
})
Expected behaviour
There should be some way to rerender the wrapper for the hook you are testing with different prop values or maybe a documented example of how to test context and hooks in this way if it already exists. Is this possible with the current implementation?
- 主要言語
- JavaScript
- スター
- 479
- フォーク
- 738
- 平均マージ
- 5日 1時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
testing-library/testing-library-docs のほかの issue
-
Broken Chrome Extension Link in Queries Docs対応中かも @rajanpanth が 67 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
testing-library/testing-library-docs#1499 ·
メンテナーはふだん 4 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
testing-library/testing-library-docs#1528 ·
メンテナーはふだん 4 日以内に返信
-
Framework wrappers and DOM testing library対応中かも @jacklaurencegaray が 429 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
testing-library/testing-library-docs#1493 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
testing-library/testing-library-docs#1486 · リアクション 1 件 ·
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
testing-library/testing-library-docs#1485 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
testing-library/testing-library-docs の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
awesome-dsh-plugin/awesome-dsh-plugin#8715 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Document embedding fails with "Cannot have chunkOverlap >= chunkSize" after switching to an embedder with a smaller max chunk length対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Mintplex-Labs/anything-llm#6810 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage Technical TODO
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
AOSSIE-Org/BabyNest#268 ·
メンテナーはふだん 1 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信