Skip to content

Commit b4a851e

Browse files
committed
Updates test for forgotPassword return data
1 parent a8b108e commit b4a851e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

packages/auth-providers-api/src/dbAuth/__tests__/DbAuthHandler.test.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -767,15 +767,16 @@ describe('dbAuth', () => {
767767
// base64 characters only, except =
768768
expect(resetUser.resetToken).toMatch(/^\w{16}$/)
769769
expect(resetUser.resetTokenExpiresAt instanceof Date).toEqual(true)
770-
// response contains the user data, minus `hashedPassword` and `salt`
770+
771+
// response contains data returned from the handler
771772
expect(responseBody.id).toEqual(resetUser.id)
772773
expect(responseBody.email).toEqual(resetUser.email)
773-
expect(responseBody.resetToken).toEqual(resetUser.resetToken)
774-
expect(responseBody.resetTokenExpiresAt).toEqual(
775-
resetUser.resetTokenExpiresAt.toISOString()
776-
)
777-
expect(responseBody.hashedPassword).toEqual(undefined)
778-
expect(responseBody.salt).toEqual(undefined)
774+
775+
// response data should not include sensitive info
776+
expect(responseBody.resetToken).toBeUndefined()
777+
expect(responseBody.resetTokenExpiresAt).toBeUndefined()
778+
expect(responseBody.hashedPassword).toBeUndefined()
779+
expect(responseBody.salt).toBeUndefined()
779780
})
780781

781782
it('returns a logout session cookie', async () => {
@@ -802,7 +803,7 @@ describe('dbAuth', () => {
802803
expect.assertions(1)
803804
})
804805

805-
it.only('removes the token from the forgotPassword response', async () => {
806+
it('removes the token from the forgotPassword response', async () => {
806807
const user = await createDbUser()
807808
event.body = JSON.stringify({
808809
username: user.email,

0 commit comments

Comments
 (0)