package infra

import "testing"

func TestPasswordVerify_CorrectPassword(t *testing.T) {
	hash, _ := PasswordHash("correct-horse-battery-staple", 4)
	if err := PasswordVerify("correct-horse-battery-staple", hash); err != nil {
		t.Fatalf("esperaba nil, got %v", err)
	}
}

func TestPasswordVerify_WrongPassword(t *testing.T) {
	hash, _ := PasswordHash("secret", 4)
	if err := PasswordVerify("wrong", hash); err == nil {
		t.Fatal("esperaba error con password incorrecto")
	}
}

func TestPasswordVerify_InvalidHash(t *testing.T) {
	if err := PasswordVerify("x", "not-a-bcrypt-hash"); err == nil {
		t.Fatal("esperaba error con hash invalido")
	}
}
