Skip to content

Commit

Permalink
fix: fix NUMSUB command (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne authored Oct 18, 2022
1 parent 0d871c9 commit bd2fdb1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ class RedisImpl implements Redis {
pubsubNumsub(...channels: string[]) {
return this.execArrayReply<BulkString | Integer>(
"PUBSUB",
"NUMSUBS",
"NUMSUB",
...channels,
);
}
Expand Down
17 changes: 17 additions & 0 deletions tests/commands/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}

0 comments on commit bd2fdb1

Please sign in to comment.