chore: 初始化 eightbf-analysis-go(对齐 Java 会商作业服务)
Go 实现 /api/v1/analysis 契约、Demo/Live Worker、DeerFlow SSE;含设计文档与冒烟脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
0c45b86d67
29 files changed
+3789
No files matched your search
@@ -0,0 +1,50 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user