1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

add test demonstrating psubscribe, and pmessage

This commit is contained in:
Benjamin Coe
2015-08-16 18:02:26 -07:00
parent e2e507eed2
commit d1558eddc2

View File

@@ -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 () { describe('punsubscribe', function () {
it('does not complain when punsubscribe is called and there are no subscriptions', function () { it('does not complain when punsubscribe is called and there are no subscriptions', function () {
sub.punsubscribe() sub.punsubscribe()