softplayer-backend/internal/helpers/hash/hash_test.go

22 lines
495 B
Go

package hash_test
import (
"testing"
"git.badhouseplants.net/softplayer/softplayer-backend/internal/helpers/hash"
"github.com/alecthomas/assert/v2"
)
func TestHashValid(t *testing.T) {
password := "qwertyu9"
hpass, err := hash.HashPassword(password, 10)
assert.NoError(t, err)
assert.NoError(t, hash.CheckPasswordHash(password, hpass))
}
func TestHashInvalid(t *testing.T) {
password := "qwertyu9"
invhash := "qwertyu9"
assert.Error(t, hash.CheckPasswordHash(password, invhash))
}