(t *testing.T)
| 20 | ) |
| 21 | |
| 22 | func TestLoadConfig_Defaults(t *testing.T) { |
| 23 | // Clear any env vars that might be set |
| 24 | os.Unsetenv("GOSQLX_MCP_HOST") |
| 25 | os.Unsetenv("GOSQLX_MCP_PORT") |
| 26 | os.Unsetenv("GOSQLX_MCP_AUTH_TOKEN") |
| 27 | |
| 28 | cfg, err := LoadConfig() |
| 29 | if err != nil { |
| 30 | t.Fatalf("unexpected error: %v", err) |
| 31 | } |
| 32 | if cfg.Host != "127.0.0.1" { |
| 33 | t.Errorf("Host = %q, want %q", cfg.Host, "127.0.0.1") |
| 34 | } |
| 35 | if cfg.Port != 8080 { |
| 36 | t.Errorf("Port = %d, want 8080", cfg.Port) |
| 37 | } |
| 38 | if cfg.AuthEnabled() { |
| 39 | t.Error("AuthEnabled() = true, want false") |
| 40 | } |
| 41 | if cfg.Addr() != "127.0.0.1:8080" { |
| 42 | t.Errorf("Addr() = %q, want %q", cfg.Addr(), "127.0.0.1:8080") |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | func TestLoadConfig_CustomPort(t *testing.T) { |
| 47 | os.Setenv("GOSQLX_MCP_PORT", "9090") |
nothing calls this directly
no test coverage detected