mirror of
https://github.com/theniceboy/.config.git
synced 2026-05-01 19:05:55 +08:00
agent tracker + tmux update
This commit is contained in:
parent
cd9c92b1c2
commit
5064629d61
68 changed files with 15041 additions and 3483 deletions
File diff suppressed because it is too large
Load diff
53
agent-tracker/cmd/tracker-server/main_test.go
Normal file
53
agent-tracker/cmd/tracker-server/main_test.go
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestNormalizeTargetNamesClearsIDPlaceholders(t *testing.T) {
|
||||
target := normalizeTargetNames(tmuxTarget{
|
||||
SessionName: "$3",
|
||||
SessionID: "$3",
|
||||
WindowName: "@12",
|
||||
WindowID: "@12",
|
||||
PaneID: "%7",
|
||||
})
|
||||
if target.SessionName != "" {
|
||||
t.Fatalf("expected placeholder session name to be cleared, got %q", target.SessionName)
|
||||
}
|
||||
if target.WindowName != "" {
|
||||
t.Fatalf("expected placeholder window name to be cleared, got %q", target.WindowName)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildStateEnvelopeUsesStoredTaskNames(t *testing.T) {
|
||||
srv := newServer()
|
||||
started := time.Date(2026, 3, 24, 10, 0, 0, 0, time.UTC)
|
||||
srv.tasks[taskKey("$3", "@12", "%7")] = &taskRecord{
|
||||
SessionID: "$3",
|
||||
SessionName: "workbench",
|
||||
WindowID: "@12",
|
||||
WindowName: "agent-tracker",
|
||||
Pane: "%7",
|
||||
Summary: "Polish notifications",
|
||||
StartedAt: started,
|
||||
Status: statusInProgress,
|
||||
Acknowledged: true,
|
||||
}
|
||||
|
||||
env := srv.buildStateEnvelope()
|
||||
if env == nil {
|
||||
t.Fatal("expected state envelope")
|
||||
}
|
||||
if len(env.Tasks) != 1 {
|
||||
t.Fatalf("expected 1 task, got %d", len(env.Tasks))
|
||||
}
|
||||
task := env.Tasks[0]
|
||||
if task.Session != "workbench" {
|
||||
t.Fatalf("expected stored session name, got %q", task.Session)
|
||||
}
|
||||
if task.Window != "agent-tracker" {
|
||||
t.Fatalf("expected stored window name, got %q", task.Window)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue