feat(v0.5.3): shared workspace-entry helper; resume + last delegate; fresh_remote prompt
This commit is contained in:
@@ -6,7 +6,9 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/warrenronsiek/ctask/internal/session"
|
||||
"github.com/warrenronsiek/ctask/internal/shell"
|
||||
)
|
||||
|
||||
@@ -128,3 +130,25 @@ func TestPreflightSuccessReturnsTmuxPath(t *testing.T) {
|
||||
t.Error("expected non-empty tmuxPath on success")
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfirmFreshRemoteAdoptionRefusesOnNonTTY(t *testing.T) {
|
||||
wsDir := t.TempDir()
|
||||
// Write a fresh remote lease so the prompt has data to display.
|
||||
other := "remote-host-xyz"
|
||||
l := &session.Lease{
|
||||
SessionID: "x", Hostname: other,
|
||||
StartedAt: time.Now().UTC(), LastHeartbeatAt: time.Now().UTC(),
|
||||
}
|
||||
if err := session.WriteLease(session.LeasePath(wsDir), l); err != nil {
|
||||
t.Fatalf("WriteLease: %v", err)
|
||||
}
|
||||
|
||||
withTTYCheck(t, func() bool { return false })
|
||||
err := confirmFreshRemoteAdoption(wsDir)
|
||||
if err == nil {
|
||||
t.Fatal("expected refusal on non-TTY")
|
||||
}
|
||||
if !strings.Contains(err.Error(), other) {
|
||||
t.Errorf("error should name the remote host: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user