summaryrefslogtreecommitdiff
path: root/tests/unit_node/async_hooks_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_node/async_hooks_test.ts')
-rw-r--r--tests/unit_node/async_hooks_test.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit_node/async_hooks_test.ts b/tests/unit_node/async_hooks_test.ts
index 5457b4d19..076d14b54 100644
--- a/tests/unit_node/async_hooks_test.ts
+++ b/tests/unit_node/async_hooks_test.ts
@@ -77,3 +77,20 @@ Deno.test(async function nested() {
assertEquals(await deferred.promise, { x: 1 });
assertEquals(await deferred1.promise, null);
});
+
+Deno.test(async function enterWith() {
+ const als = new AsyncLocalStorage();
+ const deferred = Promise.withResolvers();
+ const deferred1 = Promise.withResolvers();
+
+ als.run(null, () => {
+ als.run({ x: 1 }, () => {
+ als.enterWith({ x: 2 });
+ deferred.resolve(als.getStore());
+ });
+ deferred1.resolve(als.getStore());
+ });
+
+ assertEquals(await deferred.promise, { x: 2 });
+ assertEquals(await deferred1.promise, { x: 1 });
+});