Skip to content

Conversation

seanlion
Copy link

Overview

A workaround for returning values to use jest mock functions.
I think it would be helpful for users who wants to integrate with jest.

Usage

var redis_client = require("redis-mock")
jest.fn().mockImplementation(async (args) => {
    const result = await new Promise((resolve, reject) => {
        redis_client.command(args, function(err,result)
         {
            resolve(result);
         });
    });
    return result;
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant