Download this file
| 1 | package bot |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestConnectBrokerURLDefault(t *testing.T) { |
| 6 | // Unset → the shared broker default (matches the Node runtime, which |
| 7 | // defaults it inline; an instance sets only its per-instance token). |
| 8 | t.Setenv("LCHAT_CONNECT_BROKER_URL", "") |
| 9 | if got := loadConnectConfig().brokerURL; got != defaultBrokerURL { |
| 10 | t.Errorf("default broker URL: got %q, want %q", got, defaultBrokerURL) |
| 11 | } |
| 12 | // A self-hosted broker overrides. |
| 13 | t.Setenv("LCHAT_CONNECT_BROKER_URL", "https://connect.example.com") |
| 14 | if got := loadConnectConfig().brokerURL; got != "https://connect.example.com" { |
| 15 | t.Errorf("override broker URL: got %q", got) |
| 16 | } |
| 17 | } |
| 18 | |