https://github.com/alloc/wana-test-utils
Testing helpers for wana
https://github.com/alloc/wana-test-utils
wana
Last synced: 11 months ago
JSON representation
Testing helpers for wana
- Host: GitHub
- URL: https://github.com/alloc/wana-test-utils
- Owner: alloc
- License: mit
- Created: 2020-06-08T21:55:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-06T23:57:39.000Z (over 5 years ago)
- Last Synced: 2025-02-12T04:12:02.309Z (12 months ago)
- Topics: wana
- Language: TypeScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @wana/test-utils
Testing helpers for `wana`
## Usage
Currently, the only export is the `setupEnv` function, which provides a more
foolproof way to inject the `act` function. When you call `setupEnv`, you're
not required to set the `batchedUpdates` global.
### `setupEnv` options
- `act: Function`
### `setupEnv` example
The popular `@testing-library/react` package can be injected with two imports and one function call.
```jsx
import { setupEnv } from '@wana/test-utils'
import { act } from '@testing-library/react'
setupEnv({ act })
```
### Jest integration
If using `jest`, you can call `setupEnv` from what's called a "setup file". Try
pasting this into your `jest.config.js` file.
```js
setupFiles: ['/jest/setup.ts'],
```
Then create the `jest/setup.ts` module, and paste the first example into it.