Skip to content

Commit

Permalink
feat: add stub for readwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Jan 31, 2022
1 parent ce65aa0 commit ba8d481
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compat.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
| [quit] | :white_check_mark: | :white_check_mark: |
| [randomkey] | :white_check_mark: | :white_check_mark: |
| [readonly] | :white_check_mark: | :white_check_mark: |
| [readwrite] | :white_check_mark: | :x: |
| [readwrite] | :white_check_mark: | :white_check_mark: |
| [rename] | :white_check_mark: | :white_check_mark: |
| [renamenx] | :white_check_mark: | :white_check_mark: |
| [replconf] | :white_check_mark: | :white_check_mark: |
Expand Down
1 change: 1 addition & 0 deletions src/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export * from './punsubscribe'
export * from './quit'
export * from './randomkey'
export * from './readonly'
export * from './readwrite'
export * from './rename'
export * from './renamenx'
export * from './replconf'
Expand Down
8 changes: 8 additions & 0 deletions src/commands/readwrite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export function readwrite() {
return 'OK'
}

export function readwriteBuffer() {
const val = readwrite.call(this)
return val ? Buffer.from(val) : val
}
16 changes: 16 additions & 0 deletions test/integration/commands/readwrite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Redis from 'ioredis'

// eslint-disable-next-line import/no-relative-parent-imports
import { runTwinSuite } from '../../../test-utils'

runTwinSuite('readwrite', (command, equals) => {
describe(command, () => {
it('should return OK', async () => {
const redis = new Redis()

expect(equals(await redis[command](), 'OK')).toBe(true)

redis.disconnect()
})
})
})

0 comments on commit ba8d481

Please sign in to comment.