Skip to content

Commit 05dae5d

Browse files
committed
Update
1 parent 5888d1d commit 05dae5d

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/redis-client/redis-client-sentinel.test.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ describe("Redis Client (Sentinel)", () => {
1919
});
2020

2121
describe("Sentinel Mode", () => {
22-
2322
it("creates Sentinel client when sentinel_nodes configured", async () => {
2423
cds.env.requires.redis = {
2524
credentials: {
@@ -54,5 +53,23 @@ describe("Redis Client (Sentinel)", () => {
5453
expect(redisClient.isSentinel).toBe(true);
5554
expect(redisClient.isCluster).toBe(false);
5655
});
56+
57+
it("uses default port 26379 when not specified", async () => {
58+
cds.env.requires.redis = {
59+
credentials: {
60+
sentinel_nodes: [{ hostname: "sentinel.local" }],
61+
master_name: "mymaster",
62+
},
63+
};
64+
65+
const redisClient = RedisClient.create("default-port-test");
66+
await redisClient.createMainClientAndConnect();
67+
68+
expect(redis.createSentinel).toHaveBeenCalledWith(
69+
expect.objectContaining({
70+
sentinelRootNodes: [{ host: "sentinel.local", port: 26379 }],
71+
}),
72+
);
73+
});
5774
});
5875
});

0 commit comments

Comments
 (0)