File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
packages/async-rewriter2/src Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,16 @@ describe('AsyncWriter', function () {
370
370
expect ( await ret ) . to . equal ( 'bar' ) ;
371
371
} ) ;
372
372
373
+ it ( 'can implicitly await inside of template literals' , async function ( ) {
374
+ implicitlyAsyncFn . resolves ( 'foobar' ) ;
375
+ const ret = runTranspiledCode (
376
+ '(() => { return `>>${implicitlyAsyncFn()}<<`; })()'
377
+ ) ;
378
+ expect ( ret . constructor . name ) . to . equal ( 'Promise' ) ;
379
+ expect ( ret [ Symbol . for ( '@@mongosh.syntheticPromise' ) ] ) . to . equal ( true ) ;
380
+ expect ( await ret ) . to . equal ( '>>foobar<<' ) ;
381
+ } ) ;
382
+
373
383
it ( 'can implicitly await inside of branches' , async function ( ) {
374
384
implicitlyAsyncFn . resolves ( { foo : 'bar' } ) ;
375
385
const ret = runTranspiledCode ( `
@@ -476,6 +486,10 @@ describe('AsyncWriter', function () {
476
486
expect ( runTranspiledCode ( 'typeof nonexistent' ) ) . to . equal ( 'undefined' ) ;
477
487
} ) ;
478
488
489
+ it ( 'supports typeof for un-defined variables in parentheses' , function ( ) {
490
+ expect ( runTranspiledCode ( 'typeof ((nonexistent))' ) ) . to . equal ( 'undefined' ) ;
491
+ } ) ;
492
+
479
493
it ( 'supports typeof for implicitly awaited function calls' , async function ( ) {
480
494
implicitlyAsyncFn . resolves ( 0 ) ;
481
495
expect ( await runTranspiledCode ( 'typeof implicitlyAsyncFn()' ) ) . to . equal (
You can’t perform that action at this time.
0 commit comments