File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -349,6 +349,22 @@ describe("isCookieValid", () => {
349
349
} )
350
350
expect ( isValid ) . toBe ( false )
351
351
} )
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
+ } )
352
368
} )
353
369
354
370
describe ( "sanitizeString" , ( ) => {
You can’t perform that action at this time.
0 commit comments