How to perform unit testing on function invoked by event using Jest in React project

component.js

    import {React,useState} from 'React'
    import Container from 'react-bootstrap/Container'
    import Row from 'react-bootstrap/Row'
    import Col from 'react-bootstrap/Col'
    import Form from 'react-bootstrap/Form'
    import DatePicker from 'react-datepicker'
    import Row from 'react-bootstrap/Row'
    ...
    ...
    function Details (){
    const[initialDate, setInitialDate] = useState(new Date());
    ...
    ...
    
    return(
    <DatePicker test-id="dPicker" selected = {initialDate} onChange={(date) => setInitialDate(date)}
    )
    }

I wanted to unit test the onchange function code for above datepicker using Jest . What piece of code will help me?