@samitouri / QOS-React-2 / commits / 62512bafc6

Test fix: Add missing warning assertion (#27434)

Adds a missing test assertion for Server Context deprecation. The PR that added this warning was based on an older revision than the PR that added the test.

Andrew Clark committed Sep 28, 2023 at 12:21 UTC 62512bafc635e165eb0db26dc8efbed12d0d02fb
1 file changed +16 -2
packages/react-server-dom-turbopack/src/__tests__/ReactFlightDOMBrowser-test.js
+16 -2
@@ -612,8 +612,22 @@ describe('ReactFlightDOMBrowser', () => {
612 });
613
614 it('basic use(context)', async () => {
615 - const ContextA = React.createServerContext('ContextA', '');
616 - const ContextB = React.createServerContext('ContextB', 'B');
615 + let ContextA;
616 + let ContextB;
617 + expect(() => {
618 + ContextA = React.createServerContext('ContextA', '');
619 + ContextB = React.createServerContext('ContextB', 'B');
620 + }).toErrorDev(
621 + [
622 + 'Server Context is deprecated and will soon be removed. ' +
623 + 'It was never documented and we have found it not to be useful ' +
624 + 'enough to warrant the downside it imposes on all apps.',
625 + 'Server Context is deprecated and will soon be removed. ' +
626 + 'It was never documented and we have found it not to be useful ' +
627 + 'enough to warrant the downside it imposes on all apps.',
628 + ],
629 + {withoutStack: true},
630 + );
631
632 function ServerComponent() {
633 return use(ContextA) + use(ContextB);