mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
5a35ef34ac
- Refactor channel manager with support for Sender/Receiver interfaces and hot-swappable adapters. - Implement identity routing and pre-authentication logic for inbound messages. - Update database schema to support bot pre-auth keys and extended channel session metadata. - Add Telegram and Feishu channel configuration and adapter enhancements. - Update Swagger documentation and internal handlers for channel management. Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
655 B
Go
32 lines
655 B
Go
package channel_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/memohai/memoh/internal/channel"
|
|
)
|
|
|
|
func TestResolveTargetFromUserConfig(t *testing.T) {
|
|
t.Parallel()
|
|
registerTestChannel()
|
|
|
|
target, err := channel.ResolveTargetFromUserConfig(testChannelType, map[string]any{
|
|
"target": "alice",
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("expected no error, got %v", err)
|
|
}
|
|
if target != "resolved:alice" {
|
|
t.Fatalf("unexpected target: %s", target)
|
|
}
|
|
}
|
|
|
|
func TestResolveTargetFromUserConfigUnsupported(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
_, err := channel.ResolveTargetFromUserConfig("unknown", map[string]any{})
|
|
if err == nil {
|
|
t.Fatalf("expected error, got nil")
|
|
}
|
|
}
|