From 7963001c8911fa07b16fccea76d6d1c095462c9e Mon Sep 17 00:00:00 2001 From: Isaac <91521821+isimisi@users.noreply.github.com> Date: Tue, 12 Sep 2023 17:32:36 +0200 Subject: [PATCH] fix(iomethods.ts added hmset): added hmset in iomethods.ts --- src/ioMethods.ts | 1 + test/redis.spec.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/ioMethods.ts b/src/ioMethods.ts index dc8ba4b..684e207 100644 --- a/src/ioMethods.ts +++ b/src/ioMethods.ts @@ -87,6 +87,7 @@ export const ioMethods = [ 'hget', 'hgetBuffer', 'hmget', + 'hmset', 'hincrby', 'hincrbyfloat', 'hdel', diff --git a/test/redis.spec.ts b/test/redis.spec.ts index 9c40ca9..3af8af8 100644 --- a/test/redis.spec.ts +++ b/test/redis.spec.ts @@ -308,4 +308,32 @@ test.group('Redis Manager', () => { await redis.quit('primary') }) + + test('hmset and hmget', async ({ assert }) => { + const app = new Application(__dirname, 'web', {}) + const redis = new RedisManager( + app, + { + connection: 'primary', + connections: { + primary: { + host: process.env.REDIS_HOST, + port: Number(process.env.REDIS_PORT), + }, + cluster: { + clusters: clusterNodes, + }, + }, + }, + new Emitter(app) + ) as unknown as RedisManagerContract + + await redis.hmset('greeting', { hello: 'world' }) + const greeting = await redis.hmget('greeting', 'hello') + + assert.equal(greeting, 'world') + + await redis.del('greeting') + await redis.quit('primary') + }) })