Repository URL to install this package:
|
Version:
1.0.0 ▾
|
const FAKE_MIDDLEWARE = 'foo';
jest.mock('body-parser', () => ({ json: () => FAKE_MIDDLEWARE }));
const proxyMiddleware = require('./middleware');
describe('Proxy Middleware', () => {
it('should return only the proxy middleware when given empty options', () => {
const options = {};
const middlewares = proxyMiddleware(options);
expect(middlewares).toHaveLength(1);
});
it('should return the proper number of middlewares based on configuration supplied', () => {
const options = { parseJSON: true };
const middlewares = proxyMiddleware(options);
expect(middlewares).toHaveLength(2);
expect(middlewares).toContainEqual(FAKE_MIDDLEWARE);
});
});