Skip to content

Commit b952b61

Browse files
committed
tests
1 parent 2e78547 commit b952b61

File tree

1 file changed

+11
-36
lines changed

1 file changed

+11
-36
lines changed

packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ let React;
1111
let ReactDOMClient;
1212
let ReactDOMServer;
1313
let act;
14-
let usingPartialRenderer;
1514

1615
const util = require('util');
1716
const realConsoleError = console.error;
@@ -26,8 +25,6 @@ describe('ReactDOMServerHydration', () => {
2625
ReactDOMServer = require('react-dom/server');
2726
act = require('react-dom/test-utils').act;
2827

29-
usingPartialRenderer = global.__WWW__ && !__EXPERIMENTAL__;
30-
3128
console.error = jest.fn();
3229
container = document.createElement('div');
3330
document.body.appendChild(container);
@@ -731,15 +728,13 @@ describe('ReactDOMServerHydration', () => {
731728
);
732729
}
733730

734-
// @TODO FB bundles use a different renderer that does not serialize errors to the client
735-
const mismatchEl = usingPartialRenderer ? '<p>' : '<template>';
736731
// @TODO changes made to sending Fizz errors to client led to the insertion of templates in client rendered
737732
// suspense boundaries. This leaks in this test becuase the client rendered suspense boundary appears like
738733
// unhydrated tail nodes and this template is the first match. When we add special case handling for client
739734
// rendered suspense boundaries this test will likely change again
740735
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
741736
Array [
742-
"Warning: Did not expect server HTML to contain a ${mismatchEl} in <div>.
737+
"Warning: Did not expect server HTML to contain a <template> in <div>.
743738
in div (at **)
744739
in Mismatch (at **)",
745740
"Warning: An error occurred during hydration. The server HTML was replaced with client content in <div>.",
@@ -819,21 +814,11 @@ describe('ReactDOMServerHydration', () => {
819814
</div>
820815
);
821816
}
822-
// We gate this assertion becuase fb-classic uses PartialRenderer for renderToString and it does not
823-
// serialize server errors and send to client
824-
if (usingPartialRenderer) {
825-
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
826-
Array [
827-
"Caught [The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.]",
828-
]
829-
`);
830-
} else {
831-
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
832-
Array [
833-
"Caught [The server did not finish this Suspense boundary: The server used \\"renderToString\\" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to \\"renderToPipeableStream\\" which supports Suspense on the server]",
834-
]
835-
`);
836-
}
817+
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
818+
Array [
819+
"Caught [The server did not finish this Suspense boundary: The server used \\"renderToString\\" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to \\"renderToPipeableStream\\" which supports Suspense on the server]",
820+
]
821+
`);
837822
});
838823

839824
// @gate __DEV__
@@ -854,21 +839,11 @@ describe('ReactDOMServerHydration', () => {
854839
</div>
855840
);
856841
}
857-
// We gate this assertion becuase fb-classic uses PartialRenderer for renderToString and it does not
858-
// serialize server errors and send to client
859-
if (usingPartialRenderer) {
860-
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
861-
Array [
862-
"Caught [The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.]",
863-
]
864-
`);
865-
} else {
866-
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
867-
Array [
868-
"Caught [The server did not finish this Suspense boundary: The server used \\"renderToString\\" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to \\"renderToPipeableStream\\" which supports Suspense on the server]",
869-
]
870-
`);
871-
}
842+
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
843+
Array [
844+
"Caught [The server did not finish this Suspense boundary: The server used \\"renderToString\\" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to \\"renderToPipeableStream\\" which supports Suspense on the server]",
845+
]
846+
`);
872847
});
873848
});
874849

0 commit comments

Comments
 (0)