Skip to content

Commit

Permalink
fix: rpush error message synced with redis
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Jan 30, 2022
1 parent 8fb0fa4 commit c58eda0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion jest.config.redis.js
Expand Up @@ -45,7 +45,6 @@ module.exports = {
'test/integration/commands/publish.js',
'test/integration/commands/rpop.js',
'test/integration/commands/rpoplpush.js',
'test/integration/commands/rpush.js',
'test/integration/commands/scan.js',
'test/integration/commands/scanStream.js',
'test/integration/commands/scard.js',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/rpush.js
@@ -1,6 +1,6 @@
export function rpush(key, ...values) {
if (this.data.has(key) && !(this.data.get(key) instanceof Array)) {
throw new Error(`Key ${key} does not contain a list`)
throw new Error('WRONGTYPE Operation against a key holding the wrong kind of value')
}
const list = this.data.get(key) || []
const length = list.push(...values)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/commands/rpush.js
Expand Up @@ -26,7 +26,7 @@ runTwinSuite('rpush', command => {
try {
await redis[command]('foo', 1)
} catch (err) {
expect(err.message).toBe('Key foo does not contain a list')
expect(err.message).toBe('WRONGTYPE Operation against a key holding the wrong kind of value')
}
})
})
Expand Down

0 comments on commit c58eda0

Please sign in to comment.