overleaf/services/document-updater/test/acceptance/coffee/helpers/MockTrackChangesApi.coffee

24 lines
543 B
CoffeeScript
Raw Normal View History

express = require("express")
app = express()
module.exports = MockTrackChangesApi =
flushDoc: (doc_id, callback = (error) ->) ->
callback()
run: () ->
app.post "/project/:project_id/doc/:doc_id/flush", (req, res, next) =>
@flushDoc req.params.doc_id, (error) ->
if error?
2020-03-19 11:39:57 -04:00
res.sendStatus 500
else
2020-03-19 11:39:57 -04:00
res.sendStatus 204
2014-10-07 07:31:16 -04:00
app.listen 3015, (error) ->
throw error if error?
2017-10-20 09:56:12 -04:00
.on "error", (error) ->
console.error "error starting MockTrackChangesApi:", error.message
process.exit(1)
MockTrackChangesApi.run()