@@ -17,7 +17,7 @@ import { clear as clearComponentRegistry } from '../src/ComponentRegistry.ts';
1717enableFetchMocks ( ) ;
1818
1919// React Server Components tests require React 19 and only run with Node version 18 (`newest` in our CI matrix)
20- ( getNodeVersion ( ) >= 18 ? describe : describe . skip ) ( 'RSCClientRoot ' , ( ) => {
20+ ( getNodeVersion ( ) >= 18 ? describe : describe . skip ) ( 'registerServerComponent ' , ( ) => {
2121 let container ;
2222 const mockDomNodeId = 'test-container' ;
2323
@@ -70,11 +70,10 @@ enableFetchMocks();
7070 } ;
7171
7272 // Execute the render
73- const render = ( ) =>
74- act ( async ( ) => {
75- const Component = ReactOnRails . getComponent ( 'TestComponent' ) ;
76- await Component . component ( { } , railsContext , mockDomNodeId ) ;
77- } ) ;
73+ const render = async ( ) => {
74+ const Component = ReactOnRails . getComponent ( 'TestComponent' ) ;
75+ await Component . component ( { } , railsContext , mockDomNodeId ) ;
76+ } ;
7877
7978 return {
8079 render,
@@ -92,7 +91,7 @@ enableFetchMocks();
9291
9392 await act ( async ( ) => {
9493 pushFirstChunk ( ) ;
95- render ( ) ;
94+ await render ( ) ;
9695 } ) ;
9796 expect ( window . fetch ) . toHaveBeenCalledWith ( '/rsc-render/TestComponent?props=%7B%7D' ) ;
9897 expect ( window . fetch ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -113,7 +112,7 @@ enableFetchMocks();
113112 const { render, pushFirstChunk, pushSecondChunk, endStream } = await mockRSCRequest ( ) ;
114113
115114 await act ( async ( ) => {
116- render ( ) ;
115+ await render ( ) ;
117116 pushFirstChunk ( ) ;
118117 } ) ;
119118 expect ( consoleSpy ) . toHaveBeenCalledWith (
@@ -143,7 +142,7 @@ enableFetchMocks();
143142 const { render, pushFirstChunk, pushSecondChunk, endStream } = await mockRSCRequest ( '/rsc-render/' ) ;
144143
145144 await act ( async ( ) => {
146- render ( ) ;
145+ await render ( ) ;
147146 pushFirstChunk ( ) ;
148147 pushSecondChunk ( ) ;
149148 endStream ( ) ;
0 commit comments