Files
twenty/packages/twenty-front/src/hooks/__tests__/useUpdateEffect.test.ts
T
gitstart-twenty 5f7442cf23 Add jest tests for twenty-front (#2983)
* 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>
2023-12-15 10:53:20 +01:00

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);
});
});