refactor: stabilize runtime and unify config

This commit is contained in:
lpf
2026-03-14 21:40:12 +08:00
parent 60eee65fec
commit 341e578c9f
75 changed files with 3081 additions and 1627 deletions

View File

@@ -37,3 +37,27 @@ func TestRemindTool_UsesToolContextForDeliveryTarget(t *testing.T) {
t.Fatalf("expected to chat-123, got %q", jobs[0].Payload.To)
}
}
func TestRemindTool_ParsesStringTargets(t *testing.T) {
storePath := filepath.Join(t.TempDir(), "jobs.json")
cs := cron.NewCronService(storePath, nil)
tool := NewRemindTool(cs)
_, err := tool.Execute(context.Background(), map[string]interface{}{
"message": "call mom",
"time_expr": "10m",
"channel": "telegram",
"chat_id": "chat-456",
})
if err != nil {
t.Fatalf("Execute returned error: %v", err)
}
jobs := cs.ListJobs(true)
if len(jobs) != 1 {
t.Fatalf("expected 1 job, got %d", len(jobs))
}
if jobs[0].Payload.Channel != "telegram" || jobs[0].Payload.To != "chat-456" {
t.Fatalf("unexpected delivery target: %+v", jobs[0].Payload)
}
}