Mocking uppy with Jest

I’m trying to test a React component that uses uppy (core, XHRUpload & DragDrop) without much luck. My component imports and creates a new Uppy instance internally.

I want to just be able to assert on Uppy.setMeta or Uppy.upload being called however ideally I’d like to return a mocked response to an Uppy.on(‘complete’,()=>{}) handler.

Does anyone have a pattern this or some example code of successfully testing a similar situation please?

I ended up mocking the XHR which feels wrong but was the only thing I could get working in a reasonable amount of time.