Merge branch 'fix-typo-drive' into 'main'
[ProtonMail-WebClient.git] / packages / hooks / usePrevious.test.ts
blob50e3c3b6adaf50ed9d5727a123fab8cc1f3bb648
1 import { renderHook } from '@testing-library/react-hooks';
3 import usePrevious from './usePrevious';
5 describe('usePrevious()', () => {
6     it('remembers the value passed to it in the previous render cycle', () => {
7         const hook = renderHook(({ initial }) => usePrevious(initial), { initialProps: { initial: 0 } });
9         hook.rerender({ initial: 1 });
11         const previous = hook.result.current;
13         expect(previous).toBe(0);
14     });
15 });