Skip to content

Commit

Permalink
test: reconnect silently with promise
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Dec 9, 2020
1 parent b6b9c6b commit 85f041e
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/tests/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit 85f041e

Please sign in to comment.