fc644ecd6e
Reemplaza el scaffold del echobot por la plataforma completa de bots traida desde ~/DataProyects/Github/agents_and_robots tras la operacion Matrix-out: los bots ya no hablan por Matrix sino por el bus unibus (modelo todo-rooms + E2E via shell/transportunibus sobre github.com/enmanuel/unibus/pkg/client). - go.mod: replace de unibus -> ../unibus y de fn-registry -> ../../../.. (paths relativos reajustados a la nueva ubicacion dentro de fn_registry). - app.md: bump a 0.2.0, descripcion + arquitectura + comandos + gotchas reales. - modulo Go conservado como github.com/enmanuel/agents (sin reescribir imports). agents_and_robots queda archivado como museo de la era Matrix.
59 lines
1.4 KiB
Go
59 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestReadReloadTarget_missing(t *testing.T) {
|
|
got := readReloadTarget(filepath.Join(t.TempDir(), "reload.txt"))
|
|
if got != "" {
|
|
t.Fatalf("expected empty string for missing file, got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestReadReloadTarget_empty(t *testing.T) {
|
|
f := filepath.Join(t.TempDir(), "reload.txt")
|
|
if err := os.WriteFile(f, []byte(""), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
got := readReloadTarget(f)
|
|
if got != "" {
|
|
t.Fatalf("expected empty string for empty file, got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestReadReloadTarget_star(t *testing.T) {
|
|
f := filepath.Join(t.TempDir(), "reload.txt")
|
|
if err := os.WriteFile(f, []byte("*\n"), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
got := readReloadTarget(f)
|
|
if got != "" {
|
|
t.Fatalf("expected empty string for '*', got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestReadReloadTarget_agentID(t *testing.T) {
|
|
f := filepath.Join(t.TempDir(), "reload.txt")
|
|
if err := os.WriteFile(f, []byte("assistant-bot\n"), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
got := readReloadTarget(f)
|
|
if got != "assistant-bot" {
|
|
t.Fatalf("expected 'assistant-bot', got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestReadReloadTarget_whitespace(t *testing.T) {
|
|
f := filepath.Join(t.TempDir(), "reload.txt")
|
|
if err := os.WriteFile(f, []byte(" asistente-2 \n"), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
got := readReloadTarget(f)
|
|
if got != "asistente-2" {
|
|
t.Fatalf("expected 'asistente-2', got %q", got)
|
|
}
|
|
}
|