mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
* Rename to clarify that it's client-only * Rename FizzStreamer to FizzServer for consistency * Rename react-flight to react-client/flight For consistency with react-server. Currently this just includes flight but it could be expanded to include the whole reconciler. * Add Relay Flight Build * Rename ReactServerHostConfig to ReactServerStreamConfig This will be the config specifically for streaming purposes. There will be other configs for other purposes.
43 lines
1014 B
JavaScript
43 lines
1014 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @emails react-core
|
|
* @jest-environment node
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
let React;
|
|
let ReactNoopFlightServer;
|
|
let ReactNoopFlightClient;
|
|
|
|
describe('ReactFlight', () => {
|
|
beforeEach(() => {
|
|
jest.resetModules();
|
|
|
|
React = require('react');
|
|
ReactNoopFlightServer = require('react-noop-renderer/flight-server');
|
|
ReactNoopFlightClient = require('react-noop-renderer/flight-client');
|
|
});
|
|
|
|
it('can resolve a model', () => {
|
|
function Bar({text}) {
|
|
return text.toUpperCase();
|
|
}
|
|
function Foo() {
|
|
return {
|
|
bar: [<Bar text="a" />, <Bar text="b" />],
|
|
};
|
|
}
|
|
let transport = ReactNoopFlightServer.render({
|
|
foo: <Foo />,
|
|
});
|
|
let root = ReactNoopFlightClient.read(transport);
|
|
let model = root.model;
|
|
expect(model).toEqual({foo: {bar: ['A', 'B']}});
|
|
});
|
|
});
|