jeudi 26 novembre 2020

how to test if a function has been called that isn't passed as props from another component?

How do i test if a function that isn't being passed as props has been called with jest/RTL?

function CreateForm() {

  const submitHandler = () => {
    //do something
  }

  return(
    <button onClick={submitHandler}/>
  )
}

Aucun commentaire:

Enregistrer un commentaire