Skip to content

Commit

Permalink
feat: add unlinkBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Jan 30, 2022
1 parent e99a6ed commit 31d1368
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
1 change: 0 additions & 1 deletion compat.md
Expand Up @@ -257,7 +257,6 @@
- [sunionBuffer][1]
- [sunionstoreBuffer][1]
- [timeBuffer][1]
- [unlinkBuffer][1]
- [unsubscribeBuffer][1]
- [xaddBuffer][1]
- [xlenBuffer][1]
Expand Down
1 change: 0 additions & 1 deletion jest.config.redis.js
Expand Up @@ -71,7 +71,6 @@ module.exports = {
'test/integration/commands/sunion.js',
'test/integration/commands/sunionstore.js',
'test/integration/commands/ttl.js',
'test/integration/commands/unlink.js',
'test/integration/commands/xadd.js',
'test/integration/commands/xlen.js',
'test/integration/commands/xrange.js',
Expand Down
2 changes: 2 additions & 0 deletions src/commands/unlink.js
Expand Up @@ -4,3 +4,5 @@ export function unlink(...keys) {
const removeKeys = del.bind(this)
return removeKeys(...keys)
}

export const unlinkBuffer = unlink
45 changes: 23 additions & 22 deletions test/integration/commands/unlink.js
@@ -1,28 +1,29 @@
import Redis from 'ioredis'

describe('unlink', () => {
const redis = new Redis({
data: {
unlinkme: 'please',
metoo: 'pretty please',
},
})
it('should unlink/delete passed in keys', () => {
return redis
.unlink('unlinkme', 'metoo')
.then(status => {
return expect(status).toBe(2)
})
.then(() => {
return expect(redis.data.has('unlinkme')).toBe(false)
})
.then(() => {
return expect(redis.data.has('metoo')).toBe(false)
// eslint-disable-next-line import/no-relative-parent-imports
import { runTwinSuite } from '../../../test-utils'

runTwinSuite('unlink', command => {
describe(command, () => {
const redis = new Redis()

afterAll(() => {
redis.disconnect()
})

it('should unlink/delete passed in keys', async () => {
await redis.set('unlinkme', 'please')
await redis.set('metoo', 'pretty please')

expect(await redis[command]('unlinkme', 'metoo')).toBe(2)

expect(await redis.get('unlinkme')).toBe(null)
expect(await redis.get('metoo')).toBe(null)
})
it('should return the number of keys unlinked', async () => {
return redis[command]('deleteme', 'metoo').then(status => {
return expect(status).toBe(0)
})
})
it('should return the number of keys unlinked', () => {
return redis.unlink('deleteme', 'metoo').then(status => {
return expect(status).toBe(0)
})
})
})

0 comments on commit 31d1368

Please sign in to comment.