mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Update test to reflect new behaviour
The affected values shouldn't ever have got past the validation in the router (so the old behaviour should be unused) GitOrigin-RevId: 3afbd09bd12279125b65fb0d3ec1242f0b456d6f
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import { expect, vi } from 'vitest'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import sinon from 'sinon'
|
||||
import MockResponse from '../helpers/MockResponse.js'
|
||||
|
||||
const MODULE_PATH = new URL(
|
||||
'../../../../app/src/Features/PasswordReset/PasswordResetController.mjs',
|
||||
import.meta.url
|
||||
).pathname
|
||||
const MODULE_PATH =
|
||||
'../../../../app/src/Features/PasswordReset/PasswordResetController.mjs'
|
||||
|
||||
describe('PasswordResetController', function () {
|
||||
beforeEach(async function (ctx) {
|
||||
@@ -501,15 +499,18 @@ describe('PasswordResetController', function () {
|
||||
ctx.req.query.email = { foo: 'bar' }
|
||||
})
|
||||
|
||||
it('should set session.resetToken and redirect without email', async function (ctx) {
|
||||
it('should call next with an error', async function (ctx) {
|
||||
await new Promise(resolve => {
|
||||
ctx.req.session.should.not.have.property('resetToken')
|
||||
ctx.res.redirect = path => {
|
||||
path.should.equal('/user/password/set')
|
||||
ctx.req.session.resetToken.should.equal(ctx.token)
|
||||
const next = error => {
|
||||
expect(error).to.exist
|
||||
resolve()
|
||||
}
|
||||
ctx.PasswordResetController.renderSetPasswordForm(ctx.req, ctx.res)
|
||||
ctx.PasswordResetController.renderSetPasswordForm(
|
||||
ctx.req,
|
||||
ctx.res,
|
||||
next
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user