Skip to content

Latest commit

 

History

History
 
 

testing React hooks

Hook test

Note: hooks are mounted inside a test component following the approach shown in react-hooks-testing-library

Example:

import { mountHook } from 'cypress-react-unit-test'
// wrapper is optional, only if your hook requires
// something like a context provider
const wrapper = ({ children }) => <Provider store={store}>{children}</Provider>
mountHook(() => useCustomHook(), { wrapper })