Files
CrimsonandGitHub a4bb9ba9b4 chore: Remove sharedconfig dep and implicit init() block registry from inside plugins (#764)
* Add pkg/domain to just tidy

* Remove sharedconfig package in order to make polling period purely an engine concern

* Register plugins more explicitly in registry rather than relying on init() blocks at import time

* Update connector templates

* Start using pkg/domain imports for error and NewBasePlugin
2026-06-24 15:01:06 +00:00

33 lines
904 B
Go

package routable
import (
"encoding/json"
"testing"
)
func TestConfigDefaults(t *testing.T) {
cfg, err := unmarshalAndValidateConfig(json.RawMessage(`{"apiKey":"k"}`))
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if cfg.resolvedEndpoint() != "https://api.routable.com" {
t.Errorf("expected default endpoint, got %q", cfg.resolvedEndpoint())
}
if cfg.ActingTeamMember != "" {
t.Errorf("expected empty acting team member, got %q", cfg.ActingTeamMember)
}
}
func TestConfigRejectsMissingAPIKey(t *testing.T) {
if _, err := unmarshalAndValidateConfig(json.RawMessage(`{}`)); err == nil {
t.Fatal("expected validation error on missing apiKey")
}
}
func TestConfigRejectsBadEndpoint(t *testing.T) {
_, err := unmarshalAndValidateConfig(json.RawMessage(`{"apiKey":"k","endpoint":"not-a-url"}`))
if err == nil {
t.Fatal("expected validation error on non-URL endpoint")
}
}