[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
This commit is contained in:
Jakob Ackermann
2026-09-17 11:46:05 +00:00
committed by Copybot
parent a57d8449ef
commit 4e80098424
18 changed files with 1201 additions and 211 deletions
@@ -1,8 +1,20 @@
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) {},
@@ -10,8 +22,9 @@ module.exports = MockProjectHistoryApi = {
app.post(
'/project/:project_id/flush',
expressify(async (req, res, next) => {
const { params } = parseReq(req, flushProjectSchema)
try {
await this.flushProject(req.params.project_id)
await this.flushProject(params.project_id)
return res.sendStatus(204)
} catch (error) {
return res.sendStatus(500)
@@ -19,6 +32,8 @@ module.exports = MockProjectHistoryApi = {
})
)
app.use(handleValidationError)
return app.listen(3054, error => {
if (error != null) {
throw error