MockProjectHistoryApi.js 1.0 KB

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