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 @@ -287,6 +287,22 @@ describe("handlePasswordValidation", () => {
287
287
288
288
const matchesHash = await util . isHashMatch ( p , passwordValidation . hashedPassword )
289
289
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
+
290
306
expect ( passwordValidation . isPasswordValid ) . toBe ( false )
291
307
expect ( matchesHash ) . toBe ( false )
292
308
} )
You can’t perform that action at this time.
0 commit comments