Relative Content

Tag Archive for reactjsjestjs

Not able to write testcase for this service

getTaskData(payload) {
const reqUrl = ${this.wfmServicesUrl}/rest/MilestoneViewService/getMilestoneTaskData?nfid=${payload.nfid}&projectId=${payload.projectId}&now=${moment().unix()};
return Axios({ method: ‘get’, url: reqUrl }).then(result => result.data);
}

Testing state in fetch custom hook

I am coming from Angular and relatively new to React. I wrote a custom hook to fetch data that is working fine but I can’t test the state exposed by the hook. Specifically, I want to test that:

fireEvent.change no triggering the onSelect event

const MyPage = (props) => { const setCol = useCallback((input)=> // some implementation here myFn() // myFn is a property in props ) const handleOnSelection = useCallback ((e) => { … setCol(someInput) … }, [props] ) return ( <div> <div> <GravityLabel optional={false} size=’medium’> Select here </GravityLabel> <GravityTooltip message={msg} size=’small’ position=’top-left’/> </div> <GravityComboBox optionsArray={arr} onSelect={(e) => […]