Skip to content

Commit

Permalink
test(index): add case for async macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Comandeer committed Jun 25, 2023
1 parent ec47ebb commit b797d48
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import asyncOne from './macros/async-one.js' with { type: 'macro' };

console.log( asyncOne() );
7 changes: 7 additions & 0 deletions tests/__fixtures__/macros/async-one.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
async function asyncOne() {
return {
a: true
};
}

export default asyncOne;
9 changes: 9 additions & 0 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ test( 'inlining an object result of a default import with complex arguments', as
});`
} );

test(
'inlining an object result of a default async import without arguments',
assertBundle,
{
fixture: resolvePath( fixturesPath, 'default-import-no-arguments-async-object.js' ),
expected: 'console.log({ \'a\': true });'
}
);

test( 'old assert syntax is correctly recognized', assertBundle, {
fixture: resolvePath( fixturesPath, 'old-syntax.js' ),
expected: 'console.log(42);'
Expand Down

0 comments on commit b797d48

Please sign in to comment.