You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When supplying a second argument to lpop in redis it returns that amount of elements as a list. ioredis-mock returns a single element no matter what.
Code example:
constRedis=require("ioredis");constRedisMock=require("ioredis-mock");constassert=require("assert");constredis=newRedis();constredisMock=newRedisMock();consttestEquality=async()=>{awaitredis.rpush("key",1);awaitredis.rpush("key",2);awaitredis.rpush("key",3);awaitredisMock.rpush("key",1);awaitredisMock.rpush("key",2);awaitredisMock.rpush("key",3);constpop=awaitredis.lpop("key",3);constpopMock=awaitredisMock.lpop("key",3);awaitredis.flushall();awaitredisMock.flushall();awaitredis.quit();awaitredisMock.quit();assert(pop===popMock,`expected <${popMock.constructor.name}>(${popMock}) to equal <${pop.constructor.name}>(${pop})`);return"Success";};testEquality().then(console.log).catch(console.error);
Output:
AssertionError [ERR_ASSERTION]: expected <String>(1) to equal <Array>(1,2,3)
at testEquality (/Users/kimirti/tmp/ioredis-mock/index.js:24:3)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: '=='
}
When supplying a second argument to
lpop
in redis it returns that amount of elements as a list.ioredis-mock
returns a single element no matter what.Code example:
Output:
Found a similar issue #431
The text was updated successfully, but these errors were encountered: