package services import ( "testing" "time" "cs-agent/internal/models" "cs-agent/internal/pkg/enums" ) func TestAllowAIMessageOnPendingHandoff(t *testing.T) { conversation := &models.Conversation{ Status: enums.IMConversationStatusPending, CurrentAssigneeID: 0, HandoffAt: ptrTime(time.Now()), } if !MessageService.allowAIMessageOnPendingHandoff(conversation) { t.Fatalf("expected pending handoff conversation to allow ai handoff notice") } conversation.Status = enums.IMConversationStatusAIServing if MessageService.allowAIMessageOnPendingHandoff(conversation) { t.Fatalf("expected ai serving conversation not to use pending handoff allowance") } } func ptrTime(v time.Time) *time.Time { return &v }