mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
29e6ddd1f9
- Replace global channelRegistry singleton with explicit *Registry passed via dependency injection - Split monolithic manager.go into connection.go (lifecycle), inbound.go (dispatch), outbound.go (pipeline) - Introduce optional adapter interfaces: ConfigNormalizer, TargetResolver, BindingMatcher - Move Descriptor() to Adapter interface, remove init()-based registration - Relocate SessionHub to adapters/local package - Extract shared UUID/time helpers to internal/db/uuid.go - Decompose ConfigStore into fine-grained interfaces: ConfigLister, ConfigResolver, BindingStore, SessionStore
33 lines
686 B
Go
33 lines
686 B
Go
package channel_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/memohai/memoh/internal/channel"
|
|
)
|
|
|
|
func TestResolveTargetFromUserConfig(t *testing.T) {
|
|
t.Parallel()
|
|
reg := newTestConfigRegistry()
|
|
|
|
target, err := reg.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()
|
|
reg := channel.NewRegistry()
|
|
|
|
_, err := reg.ResolveTargetFromUserConfig("unknown", map[string]any{})
|
|
if err == nil {
|
|
t.Fatalf("expected error, got nil")
|
|
}
|
|
}
|