RaoHai / test-hooks

Simple hooks testing utilities.

Home Page:https://raohai.github.io/test-hooks/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TEST-HOOKS

styled with prettier Travis Coverage Status dependencies Status

Usage

  import testHooks from 'test-hooks'
  describe('test', () => {
    it('should test hooks', () => {
      const { act, hooks } = testHooks(() => useState(true));
      expect(hooks()[0]).toEqual(true);
      act(hook => {
        hook[1](false);
      });
      expect(hooks()[0]).toEqual(false);
    });
  });

About

Simple hooks testing utilities.

https://raohai.github.io/test-hooks/

License:MIT License


Languages

Language:TypeScript 100.0%