Skip to content

Instantly share code, notes, and snippets.

@mikekoro
Created May 9, 2020 05:49
Show Gist options
  • Save mikekoro/0a0575c3036580885b270b9a547b184c to your computer and use it in GitHub Desktop.
Save mikekoro/0a0575c3036580885b270b9a547b184c to your computer and use it in GitHub Desktop.
import React from 'react';
import { act, renderHook } from '@testing-library/react-hooks'; // Don't forget to install this package
import { useValue } from "./useValue";
it("Custom hook hooks:)", () => {
const { result } = renderHook(useValue);
act(() => {
result.current.assignValue('Hello World');
});
expect(result.current.value).toBe('Hello World');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment