From 856e5a2c10ce0714aa5cd7fc3ea1f7d0684c670c Mon Sep 17 00:00:00 2001 From: Dani Hodovic Date: Thu, 28 Jul 2016 14:39:14 +0200 Subject: [PATCH] Add retry_strategy tests --- redis/redis-tests.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/redis/redis-tests.ts b/redis/redis-tests.ts index 5acb02465e..23580ebcd7 100644 --- a/redis/redis-tests.ts +++ b/redis/redis-tests.ts @@ -27,6 +27,28 @@ redis.print(err, value); client = redis.createClient(num, str, options); +// Test the `retry_strategy` property +// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- +interface RedisRetryStrategyOptions { + error: Error; + total_retry_time: number; + times_connected: number; + attempt: number; +} +function retryStrategyNumber(options: RedisRetryStrategyOptions): number { + return 5000; +} +function retryStrategyError(options: RedisRetryStrategyOptions): Error { + return new Error('Foo'); +} +redis.createClient({ + retry_strategy: retryStrategyNumber +}); +redis.createClient({ + retry_strategy: retryStrategyError +}); +// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- + bool = client.connected; num = client.retry_delay; num = client.retry_backoff;