Merge pull request #36219 from overleaf/jpa-zod-web-platform

[web] platform: adopt strict zod schema and extend test coverage

GitOrigin-RevId: e3a0b7b4c52ac116f28be0d284284e3bd3994cda
This commit is contained in:
Jakob Ackermann
2026-09-17 11:55:40 +00:00
committed by Copybot
parent 55c23b6812
commit de0d1a7226
58 changed files with 3624 additions and 262 deletions
@@ -162,4 +162,38 @@ describe('UserActivateController', function () {
.should.equal(true)
})
})
describe('register with a missing email', function () {
beforeEach(function (ctx) {
ctx.req.body = {}
ctx.res.sendStatus = sinon.stub()
ctx.UserRegistrationHandler.promises.registerNewUserAndSendActivationEmail =
sinon.stub().resolves({ user: ctx.user, setNewPasswordUrl: 'mock/url' })
})
it('should return 422', async function (ctx) {
await ctx.UserActivateController.register(ctx.req, ctx.res)
ctx.res.sendStatus.calledWith(422).should.equal(true)
})
it('should not register a user', async function (ctx) {
await ctx.UserActivateController.register(ctx.req, ctx.res)
sinon.assert.notCalled(
ctx.UserRegistrationHandler.promises
.registerNewUserAndSendActivationEmail
)
})
})
describe('register with an empty email', function () {
beforeEach(function (ctx) {
ctx.req.body = { email: '' }
ctx.res.sendStatus = sinon.stub()
})
it('should return 422', async function (ctx) {
await ctx.UserActivateController.register(ctx.req, ctx.res)
ctx.res.sendStatus.calledWith(422).should.equal(true)
})
})
})