@@ -324,97 +324,6 @@ describe('ReactDOMServerIntegration', () => {
324
324
expect ( e . textContent ) . toBe ( 'dark' ) ;
325
325
} ) ;
326
326
327
- it ( 'does not pollute parallel node streams' , ( ) => {
328
- const LoggedInUser = React . createContext ( ) ;
329
-
330
- const AppWithUser = user => (
331
- < LoggedInUser . Provider value = { user } >
332
- < header >
333
- < LoggedInUser . Consumer > { whoAmI => whoAmI } </ LoggedInUser . Consumer >
334
- </ header >
335
- < footer >
336
- < LoggedInUser . Consumer > { whoAmI => whoAmI } </ LoggedInUser . Consumer >
337
- </ footer >
338
- </ LoggedInUser . Provider >
339
- ) ;
340
-
341
- const streamAmy = ReactDOMServer . renderToStaticNodeStream (
342
- AppWithUser ( 'Amy' ) ,
343
- ) . setEncoding ( 'utf8' ) ;
344
- const streamBob = ReactDOMServer . renderToStaticNodeStream (
345
- AppWithUser ( 'Bob' ) ,
346
- ) . setEncoding ( 'utf8' ) ;
347
-
348
- // Testing by filling the buffer using internal _read() with a small
349
- // number of bytes to avoid a test case which needs to align to a
350
- // highWaterMark boundary of 2^14 chars.
351
- streamAmy . _read ( 20 ) ;
352
- streamBob . _read ( 20 ) ;
353
- streamAmy . _read ( 20 ) ;
354
- streamBob . _read ( 20 ) ;
355
-
356
- expect ( streamAmy . read ( ) ) . toBe ( '<header>Amy</header><footer>Amy</footer>' ) ;
357
- expect ( streamBob . read ( ) ) . toBe ( '<header>Bob</header><footer>Bob</footer>' ) ;
358
- } ) ;
359
-
360
- it ( 'does not pollute parallel node streams when many are used' , ( ) => {
361
- const CurrentIndex = React . createContext ( ) ;
362
-
363
- const NthRender = index => (
364
- < CurrentIndex . Provider value = { index } >
365
- < header >
366
- < CurrentIndex . Consumer > { idx => idx } </ CurrentIndex . Consumer >
367
- </ header >
368
- < footer >
369
- < CurrentIndex . Consumer > { idx => idx } </ CurrentIndex . Consumer >
370
- </ footer >
371
- </ CurrentIndex . Provider >
372
- ) ;
373
-
374
- const streams = [ ] ;
375
-
376
- // Test with more than 32 streams to test that growing the thread count
377
- // works properly.
378
- const streamCount = 34 ;
379
-
380
- for ( let i = 0 ; i < streamCount ; i ++ ) {
381
- streams [ i ] = ReactDOMServer . renderToStaticNodeStream (
382
- NthRender ( i % 2 === 0 ? 'Expected to be recreated' : i ) ,
383
- ) . setEncoding ( 'utf8' ) ;
384
- }
385
-
386
- // Testing by filling the buffer using internal _read() with a small
387
- // number of bytes to avoid a test case which needs to align to a
388
- // highWaterMark boundary of 2^14 chars.
389
- for ( let i = 0 ; i < streamCount ; i ++ ) {
390
- streams [ i ] . _read ( 20 ) ;
391
- }
392
-
393
- // Early destroy every other stream
394
- for ( let i = 0 ; i < streamCount ; i += 2 ) {
395
- streams [ i ] . destroy ( ) ;
396
- }
397
-
398
- // Recreate those same streams.
399
- for ( let i = 0 ; i < streamCount ; i += 2 ) {
400
- streams [ i ] = ReactDOMServer . renderToStaticNodeStream (
401
- NthRender ( i ) ,
402
- ) . setEncoding ( 'utf8' ) ;
403
- }
404
-
405
- // Read a bit from all streams again.
406
- for ( let i = 0 ; i < streamCount ; i ++ ) {
407
- streams [ i ] . _read ( 20 ) ;
408
- }
409
-
410
- // Assert that all stream rendered the expected output.
411
- for ( let i = 0 ; i < streamCount ; i ++ ) {
412
- expect ( streams [ i ] . read ( ) ) . toBe (
413
- '<header>' + i + '</header><footer>' + i + '</footer>' ,
414
- ) ;
415
- }
416
- } ) ;
417
-
418
327
it ( 'does not pollute sync renders after an error' , ( ) => {
419
328
const LoggedInUser = React . createContext ( 'default' ) ;
420
329
const Crash = ( ) => {
0 commit comments