ioredis-mock
ioredis-mock copied to clipboard
Keyspace Notifications are missing
this testcase should pass:
describe('keyspaceNotifications', () => {
it('should appear when configured and the triggering event occurs', (done) => {
const redis = new MockRedis({notifyKeyspaceEvents: 'gK'}); // gK: generic keyspace
redis.on('message', (channel, message) => {
expect(channel).toBe('__keyspace@0__:key');
expect(message).toBe('del');
done();
});
redis.set('key', 'value')
.then(() => redis.del('key'));
});
});
suggestion: pass notifiy-keyspace-events configuration to MockRedis constructur (actually, this is a redis-server configuration value) see https://redis.io/topics/notifications
If interested, I am working on this (at least for some of the many keyspace notification events)
PR's welcome for sure 🙂
see PR #658