package validate

import (
	"testing"
)

func TestApproved(t *testing.T) {
	result := Approved()

	if !result.Approved {
		t.Fatal("Approved = false, want true")
	}
	if result.ReasonCode != ReasonApproved {
		t.Fatalf("ReasonCode = %q, want %q", result.ReasonCode, ReasonApproved)
	}
	if result.Message != "approved" {
		t.Fatalf("Message = %q, want approved", result.Message)
	}
}

func TestRejectedTrimsReasonAndMessage(t *testing.T) {
	result := Rejected(" invalid ", "\tmessage\n")

	if result.Approved {
		t.Fatal("Approved = true, want false")
	}
	if result.ReasonCode != "invalid" {
		t.Fatalf("ReasonCode = %q, want invalid", result.ReasonCode)
	}
	if result.Message != "message" {
		t.Fatalf("Message = %q, want message", result.Message)
	}
}
