summaryrefslogtreecommitdiff
path: root/tests/node_compat/test/parallel/test-diagnostics-channel-pub-sub.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-06-11 12:41:44 +0100
committerGitHub <noreply@github.com>2024-06-11 11:41:44 +0000
commit6a356aff1380e79d67738c5b43aa2b5fee76600d (patch)
treebe4aadc62a523ff280820958a1a3829f1a18ca7d /tests/node_compat/test/parallel/test-diagnostics-channel-pub-sub.js
parent3d41b486da7dcba49c8a18b45425e356c329d986 (diff)
chore: sync up Node.js test files for v20.11.1 (#24066)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Diffstat (limited to 'tests/node_compat/test/parallel/test-diagnostics-channel-pub-sub.js')
-rw-r--r--tests/node_compat/test/parallel/test-diagnostics-channel-pub-sub.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/node_compat/test/parallel/test-diagnostics-channel-pub-sub.js b/tests/node_compat/test/parallel/test-diagnostics-channel-pub-sub.js
index 8a8554823..ef2486f5a 100644
--- a/tests/node_compat/test/parallel/test-diagnostics-channel-pub-sub.js
+++ b/tests/node_compat/test/parallel/test-diagnostics-channel-pub-sub.js
@@ -49,3 +49,10 @@ assert.ok(!dc.unsubscribe(name, subscriber));
assert.throws(() => {
dc.subscribe(name, null);
}, { code: 'ERR_INVALID_ARG_TYPE' });
+
+// Reaching zero subscribers should not delete from the channels map as there
+// will be no more weakref to incRef if another subscribe happens while the
+// channel object itself exists.
+channel.subscribe(subscriber);
+channel.unsubscribe(subscriber);
+channel.subscribe(subscriber);