feat: add test forpassword hash
This commit is contained in:
19
internal/services/prosody/change_password_test.go
Normal file
19
internal/services/prosody/change_password_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package prosody
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_hashPassword(t *testing.T) {
|
||||
password := "test"
|
||||
salt := "317d9b92-38a4-44fb-b540-099e35fd23f7"
|
||||
accStoredKey := "3e7ac415b43be64e3935d32c447a11fe7a36cb9c"
|
||||
iterationCount := 10000
|
||||
storedKey, err := hashPassword(password, salt, iterationCount)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Compare the hashes
|
||||
require.Equal(t, storedKey, accStoredKey)
|
||||
}
|
||||
Reference in New Issue
Block a user