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

feat: support for SET with NX and GET as per redis v7 #1339

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update integration test
  • Loading branch information
akadrac authored Dec 19, 2023
commit 298ef47eef9c5dd64cbc6121828700001050f762
8 changes: 8 additions & 0 deletions test/integration/commands/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,13 @@ runTwinSuite('set', (command, equals) => {
expect(equals(await redis[command]('foo', 1, 'GET'), 'bar')).toBe(true)
redis.disconnect()
})

it('should return previous value if NX && GET is specified and the key already exists', async () => {
const redis = new Redis()
await redis[command]('foo', 'bar')

expect(equals(await redis[command]('foo', 1, 'NX', 'GET'), 'bar')).toBe(true)
redis.disconnect()
})
})
})