Files
overleaf-cep/services/document-updater/test/acceptance/js/helpers/MockProjectHistoryApi.js
T
Jakob Ackermann 4e80098424 [document-updater] adopt strict zod types and extend test coverage (#36077)
* [document-updater] adopt strict zod types and extend test coverage

* [saas-e2e] add test for project restore with binary and linked file

GitOrigin-RevId: a8e45bd1e46b6ac8a293da24c8b8ad7b236fd9bd
2026-09-17 11:46:05 +00:00

46 lines
954 B
JavaScript

let MockProjectHistoryApi
const { expressify } = require('@overleaf/promise-utils')
const express = require('express')
const {
handleValidationError,
parseReq,
z,
zz,
} = require('@overleaf/validation-tools')
const app = express()
const flushProjectSchema = z.object({
params: z.strictObject({
project_id: zz.objectId(),
}),
})
module.exports = MockProjectHistoryApi = {
async flushProject(docId) {},
run() {
app.post(
'/project/:project_id/flush',
expressify(async (req, res, next) => {
const { params } = parseReq(req, flushProjectSchema)
try {
await this.flushProject(params.project_id)
return res.sendStatus(204)
} catch (error) {
return res.sendStatus(500)
}
})
)
app.use(handleValidationError)
return app.listen(3054, error => {
if (error != null) {
throw error
}
})
},
}
MockProjectHistoryApi.run()