INNER CODE UNIT · TypeScript
ret
mongodb-js/mongosh · packages/async-rewriter-spec/src/index.ts:435
const ret = runTranspiledCode('(() => implicitlyAsyncFn().foo)()');
expect(ret.constructor.name).to.equal('Promise');
expect(ret[Symbol.for('@@mongosh.syntheticPromise')]).to.equal(true);
expect(await ret).to.equal('bar');
});
it('can implicitly await inside of block-statement arrow functions', async function () {
implicitlyAsyncFn.resolves({ foo: 'bar' });
const ret = runTranspiledCode(
'(() => { return implicitlyAsyncFn().foo; })()'
);
expect(ret.constructor.name).to.equal('Promise');
expect(ret[Symbol.for('@@mongosh.syntheticPromise')]).to.equal(true);
expect(await ret).to.equal('bar');
});
it('can implicitly await inside of template literals', async function () {
implicitlyAsyncFn.resolves('foobar');