summaryrefslogtreecommitdiff
path: root/tests/node_compat/test/parallel/test-diagnostics-channel-pub-sub.js
diff options
context:
space:
mode:
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);