Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions node/tests/PubSub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3811,15 +3811,33 @@ describe("PubSub", () => {
pubSub,
);

// Test pubsubShardchannels without pattern
const channels = await (
client2 as GlideClusterClient
).pubsubShardChannels();
expect(new Set(channels)).toEqual(
new Set([channel1, channel2, channel3]),
);
{
// Wait up to 3 seconds (60 * 50ms)
for (let i = 0; i < 60; i++) {
try {
const channels = await (
client2 as GlideClusterClient
).pubsubShardChannels();

if (channels.length === 3) {
break;
}
} catch {
// Ignore
}

await new Promise((r) => setTimeout(r, 50));
}

const channels = await (
client2 as GlideClusterClient
).pubsubShardChannels();

expect(new Set(channels)).toEqual(
new Set([channel1, channel2, channel3]),
);
}

// Test pubsubShardchannels with pattern
const channelsWithPattern = await (
client2 as GlideClusterClient
).pubsubShardChannels({ pattern });
Expand Down
Loading