summaryrefslogtreecommitdiff
path: root/cli/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit')
-rw-r--r--cli/tests/unit/globals_test.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/cli/tests/unit/globals_test.ts b/cli/tests/unit/globals_test.ts
index 184b662a4..e5ff2cc8e 100644
--- a/cli/tests/unit/globals_test.ts
+++ b/cli/tests/unit/globals_test.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-window-prefix
-import { assert, assertEquals } from "./test_util.ts";
+import { assert, assertEquals, assertRejects } from "./test_util.ts";
Deno.test(function globalThisExists() {
assert(globalThis != null);
@@ -140,3 +140,16 @@ Deno.test(function windowNameIsDefined() {
assertEquals(window.name, "");
assertEquals(name, "");
});
+
+Deno.test(async function promiseWithResolvers() {
+ {
+ const { promise, resolve } = Promise.withResolvers();
+ resolve(true);
+ assert(await promise);
+ }
+ {
+ const { promise, reject } = Promise.withResolvers();
+ reject(new Error("boom!"));
+ await assertRejects(() => promise, Error, "boom!");
+ }
+});