Files
Loki/internal/loki/chat_workspace_test.go
T
Loki de6551a153 Rebaptise AJEAN en Loki (fork, lignée conservée)
- module github.com/R0m1k3/Loki, cmd/loki, internal/loki (package loki)
- LOKI_HOME, LOKI_MODEL_DIRS, LOKI_SERVICE, LOKI_DL_CONNS ; /etc/loki ;
  units loki-engine / loki-ui ; binaire et aide CLI
- updateRepo pointe sur R0m1k3/Loki (l'auto-update ne tirera plus les
  binaires AJEAN amont)

Conservé à l'identique : le domaine ajean.link (service de tunnel amont),
les littéraux de migration 0.7.x (migrate_07.go), RELEASE_NOTES.md et
LICENSE (historique et licence de l'amont).

go build/vet/test : verts.
2026-08-14 21:33:15 +00:00

36 lines
1.0 KiB
Go

package loki
import (
"path/filepath"
"strings"
"testing"
)
// Un chemin relatif du modèle doit atterrir dans le workspace, jamais dans le
// répertoire courant du processus (Bureau, C:\ProgramData\loki\bin…).
func TestResolveAgentPathRelative(t *testing.T) {
got := resolveAgentPath("meteo.json")
want := filepath.Join(agentWorkspace(), "meteo.json")
if got != want {
t.Fatalf("resolveAgentPath = %q, attendu %q", got, want)
}
}
// Un chemin absolu demandé explicitement reste intouché.
func TestResolveAgentPathAbsolute(t *testing.T) {
abs := filepath.Join(t.TempDir(), "rapport.md")
if got := resolveAgentPath(abs); got != abs {
t.Fatalf("resolveAgentPath = %q, attendu %q", got, abs)
}
}
func TestResolveAgentPathSubdir(t *testing.T) {
got := resolveAgentPath("notes/2026/a.txt")
if !strings.HasPrefix(got, agentWorkspace()) {
t.Fatalf("%q hors du workspace %q", got, agentWorkspace())
}
if strings.Contains(got, "/") && filepath.Separator != '/' {
t.Fatalf("séparateurs non normalisés : %q", got)
}
}