overleaf/services/web/test/acceptance/coffee/helpers/MockV1Api.coffee
Michael Mazour 3922b8b916 Add project export acceptance tests
- Add acceptance tests
- Add `MockV1Api` helper
- Add flush endpoint to `MockProjectHistoryApi` helper
2018-05-16 14:58:34 +01:00

34 lines
682 B
CoffeeScript

express = require("express")
app = express()
bodyParser = require('body-parser')
app.use(bodyParser.json())
module.exports = MockV1Api =
exportId: null
exportParams: null
setExportId: (id) ->
@exportId = id
getLastExportParams: () ->
@exportParams
clearExportParams: () ->
@exportParams = null
run: () ->
app.post "/api/v1/sharelatex/exports", (req, res, next) =>
#{project, version, pathname}
@exportParams = Object.assign({}, req.body)
res.json exportId: @exportId
app.listen 5000, (error) ->
throw error if error?
.on "error", (error) ->
console.error "error starting MockOverleafAPI:", error.message
process.exit(1)
MockV1Api.run()