@@ -17,7 +17,7 @@ import { clear as clearComponentRegistry } from '../src/ComponentRegistry.ts';
17
17
enableFetchMocks ( ) ;
18
18
19
19
// 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 ' , ( ) => {
21
21
let container ;
22
22
const mockDomNodeId = 'test-container' ;
23
23
@@ -70,11 +70,10 @@ enableFetchMocks();
70
70
} ;
71
71
72
72
// 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
+ } ;
78
77
79
78
return {
80
79
render,
@@ -92,7 +91,7 @@ enableFetchMocks();
92
91
93
92
await act ( async ( ) => {
94
93
pushFirstChunk ( ) ;
95
- render ( ) ;
94
+ await render ( ) ;
96
95
} ) ;
97
96
expect ( window . fetch ) . toHaveBeenCalledWith ( '/rsc-render/TestComponent?props=%7B%7D' ) ;
98
97
expect ( window . fetch ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -113,7 +112,7 @@ enableFetchMocks();
113
112
const { render, pushFirstChunk, pushSecondChunk, endStream } = await mockRSCRequest ( ) ;
114
113
115
114
await act ( async ( ) => {
116
- render ( ) ;
115
+ await render ( ) ;
117
116
pushFirstChunk ( ) ;
118
117
} ) ;
119
118
expect ( consoleSpy ) . toHaveBeenCalledWith (
@@ -143,7 +142,7 @@ enableFetchMocks();
143
142
const { render, pushFirstChunk, pushSecondChunk, endStream } = await mockRSCRequest ( '/rsc-render/' ) ;
144
143
145
144
await act ( async ( ) => {
146
- render ( ) ;
145
+ await render ( ) ;
147
146
pushFirstChunk ( ) ;
148
147
pushSecondChunk ( ) ;
149
148
endStream ( ) ;
0 commit comments