package main import ( "baron-sso-backend/internal/service" "testing" ) func TestClassifyWorksmobileAlignFromWorksAllowsDomainOnlyEmailMismatch(t *testing.T) { item := service.WorksmobileComparisonItem{ BaronEmail: "user@typo.example.com", WorksmobileEmail: "user@example.com", } status, ok := classifyWorksmobileAlignFromWorks(item) if !ok { t.Fatalf("expected domain-only email mismatch to be alignable, status=%s", status) } if status != "updated" { t.Fatalf("expected updated status, got %s", status) } } func TestClassifyWorksmobileAlignFromWorksSkipsLocalPartChange(t *testing.T) { item := service.WorksmobileComparisonItem{ BaronEmail: "old@example.com", WorksmobileEmail: "new@example.com", } status, ok := classifyWorksmobileAlignFromWorks(item) if ok { t.Fatalf("expected local-part change to be skipped") } if status != "skipped_email_local_part_changed" { t.Fatalf("expected skipped_email_local_part_changed status, got %s", status) } }