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 @@ -349,6 +349,22 @@ describe("isCookieValid", () => {
349349 } )
350350 expect ( isValid ) . toBe ( false )
351351 } )
352+ it ( "should return false and empty string as hashedPassword when passwordMethod is invalid" , async ( ) => {
353+ const p = "password1"
354+ const passwordValidation = await util . handlePasswordValidation ( {
355+ // @ts -expect-error although this shouldn't ever happen, it ensures the default case in this function
356+ // works as expected.
357+ passwordMethod : "INVALID" ,
358+ passwordFromRequestBody : p ,
359+ passwordFromArgs : undefined ,
360+ hashedPasswordFromArgs : undefined ,
361+ } )
362+
363+ const matchesHash = await util . isHashMatch ( p , passwordValidation . hashedPassword )
364+
365+ expect ( passwordValidation . isPasswordValid ) . toBe ( false )
366+ expect ( matchesHash ) . toBe ( false )
367+ } )
352368} )
353369
354370describe ( "sanitizeString" , ( ) => {
You can’t perform that action at this time.
0 commit comments