diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index e90da886..07f0eef9 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -115,6 +115,20 @@ APIs. A similar result can be achieved by using `waitFor`: +}); ``` +Alternatively this utility can be implemented as the following, for a direct migration: + +```ts +import { waitFor } from '@testing-library/react'; + +const waitForValueToChange = async (getValue: () => T) => { + const original = getValue(); + + await waitFor(async () => { + expect(await original).not.toBe(await getValue()); + }); +}; +``` + ## `waitForNextUpdate` This utility has not been included in the React Testing Library or React Native Testing Library