Files
ai-agent/internal/services/message_service_test.go
T

30 lines
716 B
Go

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 !allowAIMessageOnPendingHandoff(conversation) {
t.Fatalf("expected pending handoff conversation to allow ai handoff notice")
}
conversation.Status = enums.IMConversationStatusAIServing
if allowAIMessageOnPendingHandoff(conversation) {
t.Fatalf("expected ai serving conversation not to use pending handoff allowance")
}
}
func ptrTime(v time.Time) *time.Time {
return &v
}