Files
Loki/internal/ajean/chat_workspace_test.go
T
nathaninline 2455d9f402 Purge du code de compatibilite jean, base bbolt et arborescence ajean
- suppression des migrations d'agencement, d'unites et de dossier de donnees
- store bbolt unique (ajean.db) : config, prefs, conversation, cles, drapeaux
- arborescence backends/ bin/ presets/ memory/ models/ workspace/
- plus aucune variable, unite ou asset nomme jean
2026-08-07 16:51:36 +02:00

36 lines
1.0 KiB
Go

package ajean
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\ajean\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)
}
}