mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 13:54:58 -05:00
3922b8b916
- Add acceptance tests - Add `MockV1Api` helper - Add flush endpoint to `MockProjectHistoryApi` helper
34 lines
682 B
CoffeeScript
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()
|