From 208998c2d1789e57f1e835bf97ba04ea24c017eb Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Thu, 28 Sep 2023 12:15:37 -0400 Subject: [PATCH] Test fix: Add missing warning assertion 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. --- .../__tests__/ReactFlightDOMBrowser-test.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightDOMBrowser-test.js b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightDOMBrowser-test.js index 94a7236e70652..b8e95f8b84ea1 100644 --- a/packages/react-server-dom-turbopack/src/__tests__/ReactFlightDOMBrowser-test.js +++ b/packages/react-server-dom-turbopack/src/__tests__/ReactFlightDOMBrowser-test.js @@ -612,8 +612,22 @@ describe('ReactFlightDOMBrowser', () => { }); it('basic use(context)', async () => { - const ContextA = React.createServerContext('ContextA', ''); - const ContextB = React.createServerContext('ContextB', 'B'); + let ContextA; + let ContextB; + expect(() => { + ContextA = React.createServerContext('ContextA', ''); + ContextB = React.createServerContext('ContextB', 'B'); + }).toErrorDev( + [ + 'Server Context is deprecated and will soon be removed. ' + + 'It was never documented and we have found it not to be useful ' + + 'enough to warrant the downside it imposes on all apps.', + 'Server Context is deprecated and will soon be removed. ' + + 'It was never documented and we have found it not to be useful ' + + 'enough to warrant the downside it imposes on all apps.', + ], + {withoutStack: true}, + ); function ServerComponent() { return use(ContextA) + use(ContextB);