From eb043e30184fff8d3483d858ffa6af5f597cbb02 Mon Sep 17 00:00:00 2001 From: Marika Marszalkowski <868536+marikaner@users.noreply.github.com> Date: Mon, 14 Aug 2023 00:57:35 +0200 Subject: [PATCH] fix: Make unsupported commands writable (#1301) --- src/index.js | 2 +- test/functional/commands.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 18d248be0..d1bb402b5 100644 --- a/src/index.js +++ b/src/index.js @@ -235,7 +235,7 @@ class RedisMock extends EventEmitter { )}, please check the full list over mocked commands: ${docsLink}` ) }, - writable: false, + writable: true, }) } }) diff --git a/test/functional/commands.js b/test/functional/commands.js index 7d033931f..bceeffde6 100644 --- a/test/functional/commands.js +++ b/test/functional/commands.js @@ -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') + }) })