import { mount } from 'enzyme'; import React from 'react'; import useMountedRef from '../hooks/useMountedRef'; describe('useMountedRef', () => { it('should work properly', () => { let ref = null; const AutoUnmounted = () => { ref = useMountedRef(); return
Mounted
; }; const wrapper = mount(); expect(ref.current).toBeTruthy(); wrapper.unmount(); expect(ref.current).toBeFalsy(); }); });