summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/import-assertions/dynamic-import-with-assertion-argument.any.js
blob: 7efb2050b72664197f1a2b5dc9efb1a67b7f0b8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// META: global=window,dedicatedworker,sharedworker

promise_test(async test => {
    const result = await import("./export-hello.js", { assert: { } });
    assert_equals(result.default, "hello");
}, "Dynamic import with an empty assert clause should succeed");

promise_test(async test => {
    return promise_rejects_js(test, TypeError,
        import("./export-hello.js", { assert: { unsupportedAssertionKey: "unsupportedAssertionValue"} }),
        "Dynamic import with an unsupported import assertion should fail");
}, "Dynamic import with an unsupported import assertion should fail");

promise_test(test => {
    return promise_rejects_js(test, TypeError,
        import("./export-hello.js", { assert: { type: "notARealType"} } ),
        "Dynamic import with an unsupported type assertion should fail");
}, "Dynamic import with an unsupported type assertion should fail");