MCPcopy
hub / github.com/facebook/react / App

Function App

packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js:265–295  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

263 const errors = [];
264 const controller = new AbortController();
265 function App() {
266 controller.abort();
267 return (
268 <Suspense fallback={<div>Loading</div>}>
269 <InfiniteSuspend />
270 </Suspense>
271 );
272 }
273 const streamPromise = serverAct(() =>
274 ReactDOMFizzServer.renderToReadableStream(
275 <div>
276 <App />
277 </div>,
278 {
279 signal: controller.signal,
280 onError(x) {
281 errors.push(x.message);
282 },
283 },
284 ),
285 );
286
287 let caughtError = null;
288 try {
289 await streamPromise;
290 } catch (error) {
291 caughtError = error;
292 }
293 expect(caughtError.message).toBe('The operation was aborted.');
294 expect(errors).toEqual(['The operation was aborted.']);
295 });
296
297 it('should reject if passing an already aborted signal', async () => {
298 const errors = [];

Callers

nothing calls this directly

Calls 4

serverActFunction · 0.70
abortMethod · 0.65
toBeMethod · 0.65
toEqualMethod · 0.65

Tested by

no test coverage detected