Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5fc498f

Browse files
chore(docs): add waitForValueToChange shim to migration guide (#924)
* Update MIGRATION_GUIDE.md
1 parent 5ba7fe9 commit 5fc498f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎MIGRATION_GUIDE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,20 @@ APIs. A similar result can be achieved by using `waitFor`:
115115
+});
116116
```
117117

118+
Alternatively this utility can be implemented as the following, for a direct migration:
119+
120+
```ts
121+
import { waitFor } from '@testing-library/react';
122+
123+
const waitForValueToChange = async <T>(getValue: () => T) => {
124+
const original = getValue();
125+
126+
await waitFor(async () => {
127+
expect(await original).not.toBe(await getValue());
128+
});
129+
};
130+
```
131+
118132
## `waitForNextUpdate`
119133

120134
This utility has not been included in the React Testing Library or React Native Testing Library

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /