Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HMSET command behavior difference #205

Open
pejrak opened this issue Apr 26, 2022 · 0 comments · May be fixed by #206
Open

HMSET command behavior difference #205

pejrak opened this issue Apr 26, 2022 · 0 comments · May be fixed by #206

Comments

@pejrak
Copy link

pejrak commented Apr 26, 2022

Hi there again. I have another difference in behavior for HMSET command in redis-mock compared to redis package.

When redis-mock is used to HMSET an 'empty' object as payload on a key, it will return undefined, but it won't call the callback.

const redisMock = require('redis-mock')
const mdb = redisMock.createClient()
mdb.hmset('hello', {}, function() { console.log('done', arguments) } ) ==> undefined

When you use the redis package, the command itself returns true, but callback throws an error.

const redis = require('redis')
const rdb = redis.createClient()
rdb.hmset('hello', {}, function() { console.log('done', arguments) } ) ==>  true

> done [Arguments] {
  '0': ReplyError: ERR wrong number of arguments for 'hmset' command
      at parseError (/var/www/kawa/app/node_modules/redis-parser/lib/parser.js:179:12)
      at parseType (/var/www/kawa/app/node_modules/redis-parser/lib/parser.js:302:14) {
    command: 'HMSET',
    args: [ 'hello' ],
    code: 'ERR'
  },
  '1': undefined
}

Runtime:
node.js v16.13.1

Npm packages:
redis-mock v0.56.3
redis v3.1.2

I will work on the PR for this, unless you want more details or have other suggestions.

pejrak added a commit to pejrak/redis-mock that referenced this issue Apr 26, 2022
@pejrak pejrak linked a pull request Apr 26, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant