package config import ( "path/filepath" "strings" "testing" ) func TestDefault(t *testing.T) { cfg := Default() if cfg.BasePath == "" { t.Fatal("BasePath is empty") } if !strings.HasSuffix(cfg.BasePath, "exo") { t.Fatalf("BasePath should end with 'exo', got %q", cfg.BasePath) } if cfg.DatabasePath == "" { t.Fatal("DatabasePath is empty") } if cfg.BlobStorePath == "" { t.Fatal("BlobStorePath is empty") } if cfg.GRPCListenAddr == "" { t.Fatal("GRPCListenAddr is empty") } } func TestFromBasePath(t *testing.T) { cfg := FromBasePath("/tmp/testexo") if cfg.BasePath != "/tmp/testexo" { t.Fatalf("expected BasePath '/tmp/testexo', got %q", cfg.BasePath) } if cfg.DatabasePath != filepath.Join("/tmp/testexo", "exo.db") { t.Fatalf("unexpected DatabasePath: %q", cfg.DatabasePath) } if cfg.BlobStorePath != filepath.Join("/tmp/testexo", "blobs") { t.Fatalf("unexpected BlobStorePath: %q", cfg.BlobStorePath) } }