I use Jest as unit testing on the React Native App I created. For currency formatting purposes I use the 'replace' function from Javascript as below:
This my code :
amount.replace(/(\d)(?=(\d{3})+(?!\d))/g,'$1.',)
I'm getting a 'TypeError: Cannot read property' replace 'of undefined' while running my TDD Jest
Please help, thank you
Already Solved, Because I Using Props.
Show The Solution is you make a default value first for handling that before the data already sent.