Raw
1 import { RedisCacheService } from "../index"
2
3 const redisClientMock = {
4 set: jest.fn(),
5 get: jest.fn(),
6 }
7
8 describe("RedisCacheService", () => {
9 let cacheService
10
11 beforeEach(() => {
12 jest.clearAllMocks()
13 })
14
15 it("Underlying client methods are called", async () => {
16 cacheService = new RedisCacheService(
17 {
18 cacheRedisConnection: redisClientMock,
19 },
20 {}
21 )
22
23 await cacheService.set("test-key", "value")
24 expect(redisClientMock.set).toBeCalled()
25
26 await cacheService.get("test-key")
27 expect(redisClientMock.get).toBeCalled()
28 })
29 })