fj/internal/api/client_test.go

29 lines
551 B
Go
Raw Normal View History

2025-12-08 10:14:47 +01:00
package api
import (
"testing"
"codeberg.org/romaintb/fgj/internal/config"
)
func TestClient_Hostname(t *testing.T) {
client := &Client{
hostname: "codeberg.org",
}
if client.Hostname() != "codeberg.org" {
t.Errorf("Expected hostname 'codeberg.org', got '%s'", client.Hostname())
}
}
func TestNewClientFromConfig_MissingHost(t *testing.T) {
cfg := &config.Config{
Hosts: map[string]config.HostConfig{},
}
_, err := NewClientFromConfig(cfg, "nonexistent.org")
if err == nil {
t.Error("Expected error for nonexistent host")
}
}