package service import ( "testing" "git.gozeros.com/wsk/eightbf-analysis-go/internal/domain" ) func TestPositionOwnerProjection(t *testing.T) { a := &AccessService{AuthEnabled: false} job := &domain.AnalysisJob{ OwnerAccountID: "owner1", Access: map[string]interface{}{ "seatAccounts": map[string]interface{}{ "seat-a": []interface{}{"acc-a"}, }, }, Dialogues: []map[string]interface{}{ {"role": "leader", "agentId": "coord", "content": "派活"}, {"role": "special", "agentId": "seat-a", "content": "本席"}, {"role": "special", "agentId": "seat-b", "content": "它席"}, {"role": "user", "content": "我说"}, }, } out := a.ProjectForCaller(job, NewCaller("acc-a", RolePositionOwner)) if len(out.Dialogues) != 3 { t.Fatalf("期望 3 条(leader+本席+user),得到 %d", len(out.Dialogues)) } for _, d := range out.Dialogues { if asStr(d["agentId"]) == "seat-b" { t.Fatal("岗位责任人不应看到它席气泡") } } } func TestPositionOwnerCannotCancel(t *testing.T) { a := &AccessService{AuthEnabled: false} job := &domain.AnalysisJob{ OwnerAccountID: "owner1", Access: map[string]interface{}{ "seatAccounts": map[string]interface{}{"seat-a": []interface{}{"acc-a"}}, }, } if a.CanCancel(job, NewCaller("acc-a", RolePositionOwner)) { t.Fatal("岗位责任人默认不能 cancel") } if !a.CanMutate(job, NewCaller("acc-a", RolePositionOwner)) { t.Fatal("岗位责任人应可 resume/inject") } }