package auth

import "testing"

func TestPasswordHashAndVerify(t *testing.T) {
	hashed, err := HashPassword("StrongPass1!")
	if err != nil {
		t.Fatalf("hash password: %v", err)
	}
	if !VerifyPassword("StrongPass1!", hashed) {
		t.Fatal("expected password to verify")
	}
	if VerifyPassword("wrong-password", hashed) {
		t.Fatal("expected wrong password to fail")
	}
}

func TestGeneratePassword(t *testing.T) {
	password, err := GeneratePassword(14)
	if err != nil {
		t.Fatalf("generate password: %v", err)
	}
	if len(password) != 14 {
		t.Fatalf("expected length 14, got %d", len(password))
	}
}
