Skip to content

Commit 5cf6c04

Browse files
committed
test: add case for standalone client without tls when ssl is false
1 parent a73bea2 commit 5cf6c04

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

packages/idempotency/tests/unit/persistence/RedisConnection.test.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ describe('Class: RedisConnection', () => {
7676
username: 'user',
7777
password: 'pass',
7878
dbIndex: 2,
79-
ssl: true,
8079
});
8180

8281
// Act
@@ -96,6 +95,33 @@ describe('Class: RedisConnection', () => {
9695
expect(createCluster).not.toHaveBeenCalled();
9796
});
9897

98+
it('creates a standalone client without `tls` when `ssl` is false', () => {
99+
// Prepare
100+
const connection = new RedisConnection({
101+
host: 'localhost',
102+
port: 6380,
103+
username: 'user',
104+
password: 'pass',
105+
dbIndex: 2,
106+
ssl: false,
107+
});
108+
109+
// Act
110+
connection.getClient();
111+
112+
// Assess
113+
expect(createClient).toHaveBeenCalledWith({
114+
username: 'user',
115+
password: 'pass',
116+
socket: {
117+
host: 'localhost',
118+
port: 6380,
119+
},
120+
database: 2,
121+
});
122+
expect(createCluster).not.toHaveBeenCalled();
123+
});
124+
99125
it('creates a cluster client when mode is set to cluster', () => {
100126
// Prepare
101127
const connection = new RedisConnection({

0 commit comments

Comments
 (0)