// mimics how Suspense treats thrown promises export async function suspendFor unknown>(throwablePromise: T) { // initially, the data reader throws the new promise expect(throwablePromise).toThrow(); try { // calling the function will throw the promise throwablePromise(); } catch(tp) { // Suspense will catch it and wait its fulfilment await tp; expect('awaited successfully').toBeTruthy(); } }