From d1558eddc2ed5bec5c09312903fbaba79bb09f8d Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Sun, 16 Aug 2015 18:02:26 -0700 Subject: [PATCH] add test demonstrating psubscribe, and pmessage --- test/pubsub.spec.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/pubsub.spec.js b/test/pubsub.spec.js index dc50246151..7678fd45bf 100644 --- a/test/pubsub.spec.js +++ b/test/pubsub.spec.js @@ -208,6 +208,20 @@ describe("publish/subscribe", function () { }); }); + describe('psubscribe', function () { + // test motivated by issue #753 + it('allows all channels to be subscribed to using a * pattern', function (done) { + sub.psubscribe('*'); + sub.on("pmessage", function(pattern, channel, message) { + assert.strictEqual(pattern, '*'); + assert.strictEqual(channel, '/foo'); + assert.strictEqual(message, 'hello world'); + return done(); + }) + pub.publish('/foo', 'hello world'); + }); + }); + describe('punsubscribe', function () { it('does not complain when punsubscribe is called and there are no subscriptions', function () { sub.punsubscribe()