package users

import (
	"testing"

	"github.com/ultisuite/ulti-backend/internal/auth"
)

func TestProvisionEmail_fromClaim(t *testing.T) {
	got := ProvisionEmail(&auth.Claims{Sub: "sub-1", Email: "a@b.com"})
	if got != "a@b.com" {
		t.Fatalf("ProvisionEmail() = %q, want a@b.com", got)
	}
}

func TestProvisionEmail_fallback(t *testing.T) {
	got := ProvisionEmail(&auth.Claims{Sub: "sub-1"})
	if got != "sub-1@unknown.ultimail.local" {
		t.Fatalf("ProvisionEmail() = %q", got)
	}
}
