File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
packages/react-server/src/__tests__ Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @emails react-core
8
+ * @jest -environment node
9
+ */
10
+
11
+ 'use strict' ;
12
+
13
+ let ReactFlightServerTemporaryReferences ;
14
+
15
+ describe ( 'ReactFlightServerTemporaryReferences' , ( ) => {
16
+ beforeEach ( ( ) => {
17
+ jest . resetModules ( ) ;
18
+ ReactFlightServerTemporaryReferences = require ( 'react-server/src/ReactFlightServerTemporaryReferences' ) ;
19
+ } ) ;
20
+
21
+ it ( 'can return a temporary reference from an async function' , async ( ) => {
22
+ const temporaryReferenceSet =
23
+ ReactFlightServerTemporaryReferences . createTemporaryReferenceSet ( ) ;
24
+ const temporaryReference =
25
+ ReactFlightServerTemporaryReferences . createTemporaryReference (
26
+ temporaryReferenceSet ,
27
+ 'test' ,
28
+ ) ;
29
+
30
+ async function foo ( ) {
31
+ return temporaryReference ;
32
+ }
33
+
34
+ await expect ( foo ( ) ) . resolves . toBe ( temporaryReference ) ;
35
+ } ) ;
36
+ } ) ;
You can’t perform that action at this time.
0 commit comments