Skip to content

Commit

Permalink
[Flight] Failing test for dropped transport of undefined object values
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Mar 25, 2023
1 parent 9c54b29 commit b447234
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/react-client/src/__tests__/ReactFlight-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,25 @@ describe('ReactFlight', () => {
expect(ReactNoop).toMatchRenderedOutput(null);
});

it('can transport undefined object values', async () => {
function ComponentClient(props) {
return 'prop' in props
? `\`prop\` in props as '${props.prop}'`
: '`prop` not in props';
}
const Component = clientReference(ComponentClient);

const model = <Component prop={undefined} />;

const transport = ReactNoopFlightServer.render(model);

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

expect(ReactNoop).toMatchRenderedOutput("`prop` in props as 'undefined'");
});

it('can render an empty fragment', async () => {
function Empty() {
return <React.Fragment />;
Expand Down

0 comments on commit b447234

Please sign in to comment.