5f7442cf23
* Add jest tests for twenty-front Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Fix tests --------- Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
19 lines
438 B
TypeScript
19 lines
438 B
TypeScript
import { renderHook } from '@testing-library/react';
|
|
|
|
import { useUpdateEffect } from '~/hooks/useUpdateEffect';
|
|
|
|
describe('useUpdateEffect', () => {
|
|
it('should call the effect callback on update', () => {
|
|
const effect = jest.fn();
|
|
const { rerender } = renderHook(() => {
|
|
useUpdateEffect(effect);
|
|
});
|
|
|
|
expect(effect).not.toHaveBeenCalled();
|
|
|
|
rerender();
|
|
|
|
expect(effect).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|