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
There is a need in a slight refactor of your tests, along with, I presume, a changes in your actual code due to this upgrade.
I suggest the following paradigm as the simplest:
import { Redis, Cluster } from 'ioredis';
jest.mock('ioredis');
// and then somewhere within the tests, or before all or however you'd like it
const setMock = jest.spyOn(Cluster.prototype, 'set');
...
expect(setMock).nthCalledWith(1, 'some-key', 'some-val', 'PXAT', 1000);
// or if you wish to actually alter the APIs results
jest.spyOn(Cluster.prototype, 'del').mockResolvedValue(1);
I have the same problem as discussed here
#1308
When I use the old "ioredis": "4.28.5",
The code works
But the latest "ioredis": "5.2.3",
throws the error Redis.Cluster is not a constructor
The text was updated successfully, but these errors were encountered: