feat: enhance event consumption logic and add success reply handling
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user