diff --git a/test/api/unit/libs/password.test.js b/test/api/unit/libs/password.test.js index a325538c5a..7c8c3fcd01 100644 --- a/test/api/unit/libs/password.test.js +++ b/test/api/unit/libs/password.test.js @@ -107,6 +107,25 @@ describe('Password Utilities', () => { } }); + it('defaults to SHA1 encryption if salt is provided', async () => { + let textPassword = 'mySecretPassword'; + let salt = sha1MakeSalt(); + let hashedPassword = sha1EncryptPassword(textPassword, salt); + + let user = { + auth: { + local: { + hashed_password: hashedPassword, + salt, + passwordHashMethod: '', + }, + }, + }; + + let isValidPassword = await compare(user, textPassword); + expect(isValidPassword).to.eql(true); + }); + it('throws an error if an invalid hashing method is used', async () => { try { await compare({