Debian Codegraph @

js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution.js

raw
1 // |reftest| async
2 // Copyright (C) 2018 Leo Balter. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 description: >
6 Dynamic Import should resolve another import call
7 esid: sec-import-call-runtime-semantics-evaluation
8 info: |
9 Runtime Semantics: Evaluation
10
11 ImportCall : import ( AssignmentExpression )
12
13 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule().
14 2. Let argRef be the result of evaluating AssignmentExpression.
15 3. Let specifier be ? GetValue(argRef).
16 4. Let promiseCapability be ! NewPromiseCapability(%Promise%).
17 5. Let specifierString be ToString(specifier).
18 6. IfAbruptRejectPromise(specifierString, promiseCapability).
19 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability).
20 8. Return promiseCapability.[[Promise]].
21 flags: [async]
22 features: [dynamic-import]
23 ---*/
24
25 import('./indirect-resolution-1_FIXTURE.js').then(async imported => {
26 assert.sameValue(Promise.resolve(imported.default), imported.default, 'default is Promise instance');
27 assert.sameValue(Object.getPrototypeOf(imported.default), Promise.prototype, 'default proto is Promise.prototype');
28 assert.sameValue(imported.default.constructor, Promise, 'default.constructor is Promise');
29
30 var indirect = await imported.default;
31 assert.sameValue(indirect.default, 42);
32 }).then($DONE, $DONE);