Skip to content

Commit 7aca5b0

Browse files
authored
Redis chore adding in unit test on reconnect strategy (#1317)
* redis - chore: adding in unit test on reconnect strategy * redis - chore: adding in unit test on reconnect strategy
1 parent 90ccb19 commit 7aca5b0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/redis/test/test.ts

+14
Original file line numberDiff line numberDiff line change
@@ -481,4 +481,18 @@ describe('KeyvRedis Iterators', () => {
481481
const keyvRedis = keyv.store as KeyvRedis<string>;
482482
expect((keyvRedis.client as RedisClientType).options?.url).toBe('redis://localhost:6379');
483483
});
484+
485+
test('should go to the RedisClientOptions if passed in', async () => {
486+
const reconnectStrategy = (times: number) => Math.min(times * 50, 2000);
487+
488+
const keyvRedis = new KeyvRedis({
489+
socket: {
490+
host: 'localhost',
491+
port: 6379,
492+
reconnectStrategy,
493+
},
494+
});
495+
496+
expect((keyvRedis.client as RedisClientType).options?.socket?.reconnectStrategy).toBe(reconnectStrategy);
497+
});
484498
});

0 commit comments

Comments
 (0)