MockRequest.js 892 B

12345678910111213141516171819202122232425262728293031323334
  1. // TODO: This file was created by bulk-decaffeinate.
  2. // Sanity-check the conversion and remove this comment.
  3. /*
  4. * decaffeinate suggestions:
  5. * DS206: Consider reworking classes to avoid initClass
  6. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  7. */
  8. class MockRequest {
  9. static initClass() {
  10. this.prototype.session = { destroy() {} }
  11. this.prototype.ip = '42.42.42.42'
  12. this.prototype.headers = {}
  13. this.prototype.params = {}
  14. this.prototype.query = {}
  15. this.prototype.body = {}
  16. this.prototype._parsedUrl = {}
  17. this.prototype.i18n = {
  18. translate(str) {
  19. return str
  20. },
  21. }
  22. this.prototype.route = { path: '' }
  23. this.prototype.accepts = () => {}
  24. this.prototype.setHeader = () => {}
  25. }
  26. param(param) {
  27. return this.params[param]
  28. }
  29. }
  30. MockRequest.initClass()
  31. module.exports = MockRequest