@isthatcentered/tickable
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.0 • Public • Published

An NPM library to help with react async testing

npm install — save @isthatcentered/tickable@beta
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( <App/> )
		
		// 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 )
	} )
} )

Package Sidebar

Install

npm i @isthatcentered/tickable

Weekly Downloads

0

Version

1.0.0-beta.0

License

ISC

Unpacked Size

130 kB

Total Files

9

Last publish

Collaborators

  • isthatcentered