Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
25 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) | ||
}) | ||
}) |