MockProjectHistoryApi.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* eslint-disable
  2. camelcase,
  3. */
  4. // TODO: This file was created by bulk-decaffeinate.
  5. // Fix any style issues and re-enable lint.
  6. /*
  7. * decaffeinate suggestions:
  8. * DS102: Remove unnecessary code created because of implicit returns
  9. * DS207: Consider shorter variations of null checks
  10. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  11. */
  12. let MockProjectHistoryApi
  13. const express = require('express')
  14. const app = express()
  15. module.exports = MockProjectHistoryApi = {
  16. flushProject(doc_id, callback) {
  17. if (callback == null) {
  18. callback = function () {}
  19. }
  20. return callback()
  21. },
  22. run() {
  23. app.post('/project/:project_id/flush', (req, res, next) => {
  24. return this.flushProject(req.params.project_id, error => {
  25. if (error != null) {
  26. return res.sendStatus(500)
  27. } else {
  28. return res.sendStatus(204)
  29. }
  30. })
  31. })
  32. return app.listen(3054, error => {
  33. if (error != null) {
  34. throw error
  35. }
  36. })
  37. },
  38. }
  39. MockProjectHistoryApi.run()