skip to Main Content

how to mock node-redis using jest

i am using jest and trying to mock node-redis using redis-mock. // redis.js const redis = require("redis"); const client = redis.createClient({ host: '127.0.0.1', port: 6379 }); // redis.test.js const redisMock = require("redis-mock"); describe("redis", () => { jest.doMock("redis", () => jest.fn(()…

VIEW QUESTION

How can I insert text before the file extension with JavaScript? – Shopify

I have image URLs like this https://cdn.shopify.com/s/files/1/0919/5078/products/DSC_9782-processed_9bef16cb-7700-48d9-ad6d-f9a350e7f6c7.jpg?v=1579953393 I need to insert _small before the file extension in order to get that image size and it should look like this https://cdn.shopify.com/s/files/1/0919/5078/products/DSC_9782-processed_9bef16cb-7700-48d9-ad6d-f9a350e7f6c7_small.jpg?v=1579953393 (Images can have different file extensions.) What's the best way…

VIEW QUESTION
Back To Top
Search