Skip to content

Commit

Permalink
Add ReactDOMClient to ServerIntegrationBasic (#28133)
Browse files Browse the repository at this point in the history
## Overview

Branched off #28130

In `hydrateRoot`, we now error if you pass `undefined`:

```
Warning: Must provide initial children as second argument to hydrateRoot. 
```

So we expect 1 error for this now.
  • Loading branch information
rickhanlonii authored and gaearon committed Feb 3, 2024
1 parent 0856ef5 commit bb42911
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegratio
const TEXT_NODE_TYPE = 3;

let React;
let ReactDOM;
let ReactDOMClient;
let ReactDOMServer;
let ReactTestUtils;

function initModules() {
// Reset warning cache.
jest.resetModules();
React = require('react');
ReactDOM = require('react-dom');
ReactDOMClient = require('react-dom/client');
ReactDOMServer = require('react-dom/server');
ReactTestUtils = require('react-dom/test-utils');

// Make them available to the helpers.
return {
ReactDOM,
ReactDOMClient,
ReactDOMServer,
ReactTestUtils,
};
Expand Down Expand Up @@ -149,8 +149,10 @@ describe('ReactDOMServerIntegration', () => {
expect(await render([])).toBe(null);
expect(await render(false)).toBe(null);
expect(await render(true)).toBe(null);
expect(await render(undefined)).toBe(null);
expect(await render([[[false]], undefined])).toBe(null);

// hydrateRoot errors for undefined children.
expect(await render(undefined, 1)).toBe(null);
});
});
});

0 comments on commit bb42911

Please sign in to comment.