Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
jest.mock('redis', () => ({
redisClient: jest.fn(() => 'redis client object')
}));
const { parse } = require('querystring');
const addImgOptMiddleware = require('../addImgOptMiddleware');
const expressSharp = require('@magento/express-sharp');
const apicache = require('apicache');
const redis = require('redis');
const mockSharpMiddleware = expressSharp.__mockMiddleware;
const mockCacheMiddleware = apicache.__mockMiddleware;
let app;
let config;
let filterMiddleware;
let req;
let res;
const next = () => {};
const testUrl = (url, method = 'GET') => {
addImgOptMiddleware(app, config);
const { pathname, search } = new URL(url, 'http://localhost');
req = {
method,
path: pathname,
query: parse(search.replace(/^\?/, '')),