mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
Creating default encryption test to improve coverage (#10651)
This commit is contained in:
@@ -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 () => {
|
it('throws an error if an invalid hashing method is used', async () => {
|
||||||
try {
|
try {
|
||||||
await compare({
|
await compare({
|
||||||
|
|||||||
Reference in New Issue
Block a user