Skip to content

Commit

Permalink
fix: Make unsupported commands writable (#1301)
Browse files Browse the repository at this point in the history
  • Loading branch information
marikaner committed Aug 13, 2023
1 parent 4bb0327 commit eb043e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class RedisMock extends EventEmitter {
)}, please check the full list over mocked commands: ${docsLink}`
)
},
writable: false,
writable: true,
})
}
})
Expand Down
8 changes: 8 additions & 0 deletions test/functional/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@ describe('commands', () => {
`"Unsupported command: "debugBuffer", please check the full list over mocked commands: https://github.com/stipsan/ioredis-mock/blob/main/compat.md#supported-commands-"`
)
})

test('unsupported commands should be writable', () => {
const redis = new Redis()
expect(() => {
redis.debug = () => 'DEBUG'
}).not.toThrow()
expect(redis.debug()).toEqual('DEBUG')
})
})

0 comments on commit eb043e3

Please sign in to comment.