(t *testing.T)
| 34 | } |
| 35 | |
| 36 | func TestHubResolveAppendReadFlow(t *testing.T) { |
| 37 | h := newHubHandler(t) |
| 38 | ctx := userCtx("alice", RoleUser) |
| 39 | |
| 40 | res, err := h.ResolveActiveConversation(ctx, &pb.ResolveActiveConversationRequest{}) |
| 41 | if err != nil { |
| 42 | t.Fatalf("ResolveActiveConversation: %v", err) |
| 43 | } |
| 44 | if res.ConvId == "" || res.Principal != "alice" { |
| 45 | t.Fatalf("unexpected resolve response: %+v", res) |
| 46 | } |
| 47 | |
| 48 | _, err = h.AppendEvent(ctx, &pb.AppendEventRequest{ |
| 49 | ConvId: res.ConvId, Channel: "local", Role: "user", Content: "hi from notebook", |
| 50 | }) |
| 51 | if err != nil { |
| 52 | t.Fatalf("AppendEvent: %v", err) |
| 53 | } |
| 54 | |
| 55 | read, err := h.ReadConversation(ctx, &pb.ReadConversationRequest{ConvId: res.ConvId}) |
| 56 | if err != nil { |
| 57 | t.Fatalf("ReadConversation: %v", err) |
| 58 | } |
| 59 | if len(read.Events) != 1 || read.Events[0].Content != "hi from notebook" { |
| 60 | t.Fatalf("unexpected read: %+v", read.Events) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | func TestHubCrossPrincipalIsolation(t *testing.T) { |
| 65 | h := newHubHandler(t) |
nothing calls this directly
no test coverage detected