https://github.com/isthatcentered/tickable
A utility to make testing asynchronous react component easy
https://github.com/isthatcentered/tickable
Last synced: 11 months ago
JSON representation
A utility to make testing asynchronous react component easy
- Host: GitHub
- URL: https://github.com/isthatcentered/tickable
- Owner: isthatcentered
- Created: 2019-01-15T18:26:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-28T03:40:52.000Z (over 5 years ago)
- Last Synced: 2025-06-15T14:49:00.799Z (12 months ago)
- Language: JavaScript
- Size: 659 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# An NPM library to help with react async testing
```bash
npm install — save @isthatcentered/tickable@beta
```
```typescript jsx
describe( `No results found`, () => {
beforeEach( () => {
mock.mockImplementation( () =>
Tickable( response ) ) // Tickable returns a Promise that will resolve on process.nextTick
} )
test( `Displays a message`, async () => {
const wrapper = mount( )
// At this point, nextTick hasn't happened so Promise is still unresolved
await tick() // Force our Tickable promise resolve
// Now we can test expectations depending on our promise resolve
expect( wrapper ).toHaveText( /nothing found/i )
} )
} )
```