mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* 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
33 lines
904 B
Go
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")
|
|
}
|
|
}
|