Spotify.validateTrack.mockImplementation(trackMock)
Decorator.parse.mockResolvedValue('unifiedMessage')
User.findOneAndUpdate.mockRejectedValue(new Error('bang'))
This snipper shows which props have changed to cuase a rerender
import React, { useRef, useEffect } from 'react'
function useTraceUpdate(props) {
const prev = useRef(props);
useEffect(() => {
const changedProps = Object.entries(props).reduce((ps, [k, v]) => {
if (prev.current[k] !== v) {
ps[k] = [prev.current[k], v];
}
return ps;
}, {});
if (Object.keys(changedProps).length > 0) {
console.log('Changed props:', changedProps);
}
prev.current = props;
});
}
useTraceUpdate(props);