mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01: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 sinon from 'sinon'
|
||||||
import MockResponse from '../helpers/MockResponse.js'
|
import MockResponse from '../helpers/MockResponse.js'
|
||||||
|
|
||||||
const MODULE_PATH = new URL(
|
const MODULE_PATH =
|
||||||
'../../../../app/src/Features/PasswordReset/PasswordResetController.mjs',
|
'../../../../app/src/Features/PasswordReset/PasswordResetController.mjs'
|
||||||
import.meta.url
|
|
||||||
).pathname
|
|
||||||
|
|
||||||
describe('PasswordResetController', function () {
|
describe('PasswordResetController', function () {
|
||||||
beforeEach(async function (ctx) {
|
beforeEach(async function (ctx) {
|
||||||
@@ -501,15 +499,18 @@ describe('PasswordResetController', function () {
|
|||||||
ctx.req.query.email = { foo: 'bar' }
|
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 => {
|
await new Promise(resolve => {
|
||||||
ctx.req.session.should.not.have.property('resetToken')
|
ctx.req.session.should.not.have.property('resetToken')
|
||||||
ctx.res.redirect = path => {
|
const next = error => {
|
||||||
path.should.equal('/user/password/set')
|
expect(error).to.exist
|
||||||
ctx.req.session.resetToken.should.equal(ctx.token)
|
|
||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
ctx.PasswordResetController.renderSetPasswordForm(ctx.req, ctx.res)
|
ctx.PasswordResetController.renderSetPasswordForm(
|
||||||
|
ctx.req,
|
||||||
|
ctx.res,
|
||||||
|
next
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user