You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-11Lines changed: 26 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -403,24 +403,39 @@ See also: [Building Your Own React Hooks](https://reactjs.org/docs/hooks-custom.
403
403
## How to Test Your Custom Hooks
404
404
405
405
So far, we have explained that hooks should be called within `HookScope` or `HookView`. Then, how can the custom hook you have created be tested?
406
-
For such purposes, there is an API to create a temporary hook scope independent of SwiftUI view.
406
+
To making unit testing of your custom hooks easy, SwiftUI-Hooks provides a simple and complete test utility library `HooksTesting`.
407
407
408
-
Within the `withTemporaryHookScope` function, you can launch the hook scope multiple times to test state transitions in cases such as when the SwiftUI view is evaluated multiple times.
408
+
`HookTester` enables unit testing independent of UI of custom hooks by simulating the behavior on the view of a given hook and managing the result values.
0 commit comments