import React from 'react'; import { mount } from 'enzyme'; import useSyncState from '../hooks/useSyncState'; describe('Table', () => { it('useSyncState', () => { const Test = () => { const [getVal, setVal] = useSyncState('light'); return ( { setVal('bamboo'); }} > {getVal()} ); }; const wrapper = mount(); expect(wrapper.text()).toEqual('light'); wrapper.find('span').simulate('click'); expect(wrapper.text()).toEqual('bamboo'); }); });