Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions shortcuts/bot/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ func TestNewBotHandler_MissingSessionManager(t *testing.T) {

// TestBotHandler_extractTextContent tests text content extraction
func TestBotHandler_extractTextContent(t *testing.T) {
handler, _ := NewBotHandler(BotHandlerConfig{
ClaudeClient: NewClaudeClient(ClaudeClientConfig{}),
SessionManager: nil, // OK for this test
WorkDir: "/tmp",
})
// Use &BotHandler{} directly for helper-level tests that only exercise
// extractTextContent (doesn't touch receiver state)
handler := &BotHandler{}

tests := []struct {
name string
Expand Down Expand Up @@ -185,11 +183,9 @@ func TestBotHandler_parseMessageEvent(t *testing.T) {

// TestBotHandler_parseMessageEvent_MissingFields tests error handling for incomplete events
func TestBotHandler_parseMessageEvent_MissingFields(t *testing.T) {
handler, _ := NewBotHandler(BotHandlerConfig{
ClaudeClient: NewClaudeClient(ClaudeClientConfig{}),
SessionManager: nil,
WorkDir: "/tmp",
})
// Use &BotHandler{} directly since parseMessageEvent only parses event data
// and doesn't require SessionManager or ClaudeClient
handler := &BotHandler{}

tests := []struct {
name string
Expand Down
3 changes: 2 additions & 1 deletion shortcuts/bot/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ func TestSessionManager_CleanupExpired(t *testing.T) {
// Wait for expiration
time.Sleep(60 * time.Millisecond)

// Refresh the active session to keep it alive
// Refresh the active session AFTER the sleep to keep it alive.
// This updates its mtime so it won't be expired when CleanupExpired runs.
sm.Set("chat_active", "session_active_refreshed")

// Cleanup expired
Expand Down