mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
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:
@@ -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)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user