Files
overleaf-cep/services/web/test/unit/src/helpers/MockRequest.js
T
Jessica Lawshe 8a0f2dbe1d Merge pull request #15419 from overleaf/em-error-request-logging
Use the request logger for errors in web

GitOrigin-RevId: f654fc69e0bbdab8b16d23b007aefbad08925358
2023-10-31 09:04:36 +00:00

33 lines
580 B
JavaScript

const sinon = require('sinon')
class MockRequest {
constructor() {
this.session = { destroy() {} }
this.ip = '42.42.42.42'
this.headers = {}
this.params = {}
this.query = {}
this.body = {}
this._parsedUrl = {}
this.i18n = {
translate(str) {
return str
},
}
this.route = { path: '' }
this.accepts = () => {}
this.setHeader = () => {}
this.logger = {
addFields: sinon.stub(),
setLevel: sinon.stub(),
}
}
param(param) {
return this.params[param]
}
}
module.exports = MockRequest