Open raulrojasadl opened 3 years ago
Hi dear friends,
I want to know what is the right way to test the error result, In my test code I use
jest.mock("redis", () => jest.requireActual("redis-mock")); describe("redis functions tests OK", () => {......}
But always I can test the success results very easy, for example:
const set = (key, data, dbOptions) => new Promise((resolve, reject) => createClient(dbOptions) .then((client) => client.set(key, data, (err, res) => (err ? reject(err) : resolve(res))) ) .catch(reject) );
This, works fine.
it("set success", async () => await expect(redisFunctions.set("key", "hello", dbOptions)).resolves.toBe( "OK" ));
But, I don't know how to return an Error in client.set(key, data, (err, res) using redis-mock with the current configuration.
client.set(key, data, (err, res)
Thanks for your help.
Would be cool to have this feature, so I can test error paths in the code
Hi dear friends,
I want to know what is the right way to test the error result, In my test code I use
But always I can test the success results very easy, for example:
This, works fine.
But, I don't know how to return an Error in
client.set(key, data, (err, res)
using redis-mock with the current configuration.Thanks for your help.