Skip to content

Commit

Permalink
Add ReactDOMClient to ServerIntegrationHooks
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Jan 28, 2024
1 parent 233b65d commit d1eb303
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegrationTestUtils');

let React;
let ReactDOM;
let ReactDOMClient;
let ReactDOMServer;
let ReactTestUtils;
let useState;
Expand All @@ -39,7 +39,7 @@ function initModules() {
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');
useState = React.useState;
Expand Down Expand Up @@ -67,7 +67,7 @@ function initModules() {

// Make them available to the helpers.
return {
ReactDOM,
ReactDOMClient,
ReactDOMServer,
ReactTestUtils,
};
Expand Down Expand Up @@ -422,7 +422,7 @@ describe('ReactDOMServerHooks', () => {
});
return 'hi';
}

// TODO: fails due to render error retry
const domNode = await render(<App />, 1);
expect(domNode.textContent).toEqual('hi');
});
Expand All @@ -436,6 +436,7 @@ describe('ReactDOMServerHooks', () => {
return value;
}

// TODO: fails due to render error retry
const domNode = await render(<App />, 1);
expect(domNode.textContent).toEqual('0');
});
Expand Down Expand Up @@ -859,9 +860,11 @@ describe('ReactDOMServerHooks', () => {
return <Text text={count} />;
}

// TODO: fails due to render error retry
const domNode1 = await render(<ReadInMemo />, 1);
expect(domNode1.textContent).toEqual('42');

// TODO: fails due to render error retry
const domNode2 = await render(<ReadInReducer />, 1);
expect(domNode2.textContent).toEqual('42');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegrationTestUtils');

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 @@ -365,6 +365,7 @@ describe('ReactDOMServerIntegration', () => {
</div>
);
};
// TODO: fails due to render error retry
// We expect 1 error.
await render(<App />, 1);
},
Expand All @@ -391,6 +392,7 @@ describe('ReactDOMServerIntegration', () => {
</div>
);
};
// TODO: fails due to render error retry
// We expect 1 error.
await render(<App />, 1);
},
Expand Down

0 comments on commit d1eb303

Please sign in to comment.