mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
refactor(context): carry route and scope through runtime
This commit is contained in:
@@ -26,6 +26,15 @@ func TestAllocateRouteSession_PerPeerDM(t *testing.T) {
|
||||
if allocation.MainSessionKey != "agent:main:main" {
|
||||
t.Fatalf("MainSessionKey = %q, want %q", allocation.MainSessionKey, "agent:main:main")
|
||||
}
|
||||
if allocation.Scope.Version != ScopeVersionV1 {
|
||||
t.Fatalf("Scope.Version = %d, want %d", allocation.Scope.Version, ScopeVersionV1)
|
||||
}
|
||||
if len(allocation.Scope.Dimensions) != 1 || allocation.Scope.Dimensions[0] != "sender" {
|
||||
t.Fatalf("Scope.Dimensions = %v, want [sender]", allocation.Scope.Dimensions)
|
||||
}
|
||||
if allocation.Scope.Values["sender"] != "user123" {
|
||||
t.Fatalf("Scope.Values[sender] = %q, want user123", allocation.Scope.Values["sender"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestAllocateRouteSession_GroupPeer(t *testing.T) {
|
||||
@@ -48,4 +57,10 @@ func TestAllocateRouteSession_GroupPeer(t *testing.T) {
|
||||
if allocation.MainSessionKey != "agent:main:main" {
|
||||
t.Fatalf("MainSessionKey = %q, want %q", allocation.MainSessionKey, "agent:main:main")
|
||||
}
|
||||
if len(allocation.Scope.Dimensions) != 1 || allocation.Scope.Dimensions[0] != "chat" {
|
||||
t.Fatalf("Scope.Dimensions = %v, want [chat]", allocation.Scope.Dimensions)
|
||||
}
|
||||
if allocation.Scope.Values["chat"] != "channel:c001" {
|
||||
t.Fatalf("Scope.Values[chat] = %q, want channel:c001", allocation.Scope.Values["chat"])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user