File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,22 @@ describe("handlePasswordValidation", () => {
287287
288288 const matchesHash = await util . isHashMatch ( p , passwordValidation . hashedPassword )
289289
290+ expect ( passwordValidation . isPasswordValid ) . toBe ( false )
291+ expect ( matchesHash ) . toBe ( false )
292+ } )
293+ it ( "should return false and empty string as hashedPassword when passwordMethod is invalid" , async ( ) => {
294+ const p = "password1"
295+ const passwordValidation = await util . handlePasswordValidation ( {
296+ // @ts -expect-error although this shouldn't ever happen, it ensures the default case in this function
297+ // works as expected.
298+ passwordMethod : "INVALID" ,
299+ passwordFromRequestBody : p ,
300+ passwordFromArgs : undefined ,
301+ hashedPasswordFromArgs : undefined ,
302+ } )
303+
304+ const matchesHash = await util . isHashMatch ( p , passwordValidation . hashedPassword )
305+
290306 expect ( passwordValidation . isPasswordValid ) . toBe ( false )
291307 expect ( matchesHash ) . toBe ( false )
292308 } )
You can’t perform that action at this time.
0 commit comments