Updates from reviewers

This commit is contained in:
lilleman
2026-06-09 10:03:53 +02:00
parent cee2f35a2c
commit 5b6480a094
15 changed files with 845 additions and 498 deletions
+16
View File
@@ -3,9 +3,25 @@ package fakes
import (
"os"
"path/filepath"
"reflect"
"testing"
)
// TestList pins the discoverable paths: every category, its dotted fields, and
// folder segments — descending transparently through single-variant choices.
func TestList(t *testing.T) {
dir := writeData(t, map[string]string{
"person": `{"format":"{first} {last}","first":["A"],"last":["B"]}`,
"word": `["x", "y"]`,
"geo/city": `["Z"]`,
})
got := newFakes(t, dir, WithSeed(1)).List()
want := []string{"geo.city", "person", "person.first", "person.last", "word"}
if !reflect.DeepEqual(got, want) {
t.Fatalf("List() = %v, want %v", got, want)
}
}
// writeData builds a temp data directory from a map of relative path (without
// ".json") -> file content, creating parent folders as needed. The directory's
// name carries no meaning anymore, so callers pick any layout they like —