From 3889e2321acbe6ce8b2698c073cd9476d2a97a35 Mon Sep 17 00:00:00 2001 From: KahWee Teng <262105+kahwee@users.noreply.github.com> Date: Sat, 12 Oct 2019 07:41:57 -0700 Subject: [PATCH] Add { act } to be part of import Missed out a couple of exports to make the code work out of the box. --- docs/usage/advanced-hooks.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/usage/advanced-hooks.md b/docs/usage/advanced-hooks.md index 86418bd9..fd7abf1e 100644 --- a/docs/usage/advanced-hooks.md +++ b/docs/usage/advanced-hooks.md @@ -36,7 +36,7 @@ export function useCounter(initialValue = 0) { In our test, we simply use `CounterStepProvider` as the `wrapper` when rendering the hook: ```js -import { renderHook } from '@testing-library/react-hooks' +import { renderHook, act } from '@testing-library/react-hooks' import { CounterStepProvider, useCounter } from './counter' test('should use custom step when incrementing', () => { @@ -72,7 +72,7 @@ file: ```js /* eslint-disable react/display-name */ -import { renderHook } from '@testing-library/react-hooks' +import { renderHook, act } from '@testing-library/react-hooks' import { CounterStepProvider, useCounter } from './counter' test('should use custom step when incrementing', () => { @@ -118,7 +118,7 @@ export function useCounter(initialValue = 0) { To test `incrementAsync` we need to `await waitForNextUpdate()` before the make our assertions: ```js -import { renderHook, act } from '@testing-library/react-hooks' +import { renderHook } from '@testing-library/react-hooks' import { useCounter } from './counter' test('should increment counter after delay', async () => {