diff --git a/src/tests/client.ts b/src/tests/client.ts index 21fb889a..1d1a2cdf 100644 --- a/src/tests/client.ts +++ b/src/tests/client.ts @@ -664,21 +664,30 @@ describe('reconnecting', () => { it('should reconnect silently after socket closes', async () => { const { url, ...server } = await startTServer(); - const sub = tsubscribe( - createClient({ - url, - retryAttempts: 1, - }), - { - query: 'subscription { ping }', - }, - ); + const client = createClient({ + url, + retryAttempts: 3, + retryWait: () => Promise.resolve(), + }); + const sub = tsubscribe(client, { + query: 'subscription { ping }', + }); + + await server.waitForClient((client) => { + client.close(); + }); + + // retried + await server.waitForClient((client) => { + client.close(); + }); + // once more await server.waitForClient((client) => { client.close(); }); - // tried again + // and once more await server.waitForClient((client) => { client.close(); });