diff --git a/redis.ts b/redis.ts index f43f52fe..0b4b23b5 100644 --- a/redis.ts +++ b/redis.ts @@ -1180,7 +1180,7 @@ class RedisImpl implements Redis { pubsubNumsub(...channels: string[]) { return this.execArrayReply( "PUBSUB", - "NUMSUBS", + "NUMSUB", ...channels, ); } diff --git a/tests/commands/pubsub.ts b/tests/commands/pubsub.ts index 602f3e34..67ac1f24 100644 --- a/tests/commands/pubsub.ts +++ b/tests/commands/pubsub.ts @@ -149,4 +149,21 @@ export function pubsubTests( assert(sub.isClosed); }, }); + + it("pubsubNumsub()", async () => { + const opts = getOpts(); + const subClient1 = await newClient(opts); + await subClient1.subscribe("test1", "test2"); + + const subClient2 = await newClient(opts); + await subClient2.subscribe("test2", "test3"); + + const pubClient = await newClient(opts); + const resp = await pubClient.pubsubNumsub("test1", "test2", "test3"); + assertEquals(resp, ["test1", 1, "test2", 2, "test3", 1]); + + subClient1.close(); + subClient2.close(); + pubClient.close(); + }); }