Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ describe('_default/05-features/05-presence_format.md', () => {
});
// jack is online while john reads the channel
extraClients.push(await getClientSideClient({ id: jackId }));
// jack connected and disconnected in an earlier test: the channel's member data reports
// the new connection a few seconds after it opens. Polled as john (the server-side
// response catches up sooner) with the raw query, which loads no channel state.
await retry(async () => {
const { channels } = await client.queryChannels({
filter_conditions: { cid: `messaging:${presenceChannelId}` },
state: true,
watch: false,
});
const jack = channels[0]?.members.find((m) => m.user_id === jackId);
expect(jack?.user?.online).toBe(true);
});

const logSpy = vi.spyOn(console, 'log').mockImplementation(() => undefined);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,19 @@ describe(DOCS, () => {
});

it('re-queries registered lists after a reconnect', async () => {
const toTailSpy = vi.spyOn(paginator, 'toTail');
const recoverSpy = vi.spyOn(paginator, 'recoverLoadedItems');
const querySpy = vi.spyOn(client, 'queryChannelsAndHydrate');
try {
await client.closeConnection();
await client.openConnection();
await retry(() => {
expect(toTailSpy).toHaveBeenCalled();
expect(recoverSpy).toHaveBeenCalled();
expect(querySpy).toHaveBeenCalled();
return Promise.resolve();
});
} finally {
toTailSpy.mockRestore();
recoverSpy.mockRestore();
querySpy.mockRestore();
}
});

Expand Down
Loading