Skip to content

Commit 67c618f

Browse files
committed
[Flight] Add gated test for desired behavior for undefined props
1 parent b447234 commit 67c618f

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

packages/react-client/src/__tests__/ReactFlight-test.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,23 +213,38 @@ describe('ReactFlight', () => {
213213
expect(ReactNoop).toMatchRenderedOutput(null);
214214
});
215215

216-
it('can transport undefined object values', async () => {
217-
function ComponentClient(props) {
216+
// @gate FIXME
217+
it('should transport undefined object values', async () => {
218+
function ServerComponent(props) {
218219
return 'prop' in props
219220
? `\`prop\` in props as '${props.prop}'`
220221
: '`prop` not in props';
221222
}
222-
const Component = clientReference(ComponentClient);
223+
const ClientComponent = clientReference(ServerComponent);
223224

224-
const model = <Component prop={undefined} />;
225+
const model = (
226+
<>
227+
<div>
228+
Server: <ServerComponent prop={undefined} />
229+
</div>
230+
<div>
231+
Client: <ClientComponent prop={undefined} />
232+
</div>
233+
</>
234+
);
225235

226236
const transport = ReactNoopFlightServer.render(model);
227237

228238
await act(async () => {
229239
ReactNoop.render(await ReactNoopFlightClient.read(transport));
230240
});
231241

232-
expect(ReactNoop).toMatchRenderedOutput("`prop` in props as 'undefined'");
242+
expect(ReactNoop).toMatchRenderedOutput(
243+
<>
244+
<div>Server: `prop` in props as 'undefined'</div>
245+
<div>Client: `prop` in props as 'undefined'</div>
246+
</>,
247+
);
233248
});
234249

235250
it('can render an empty fragment', async () => {

0 commit comments

Comments
 (0)