mirror of
https://github.com/hanzozt/sdk-golang.git
synced 2026-10-30 14:46:37 +00:00
Add three new packages for ZT SDK integration: - zap/: ZAP transport adapter with 4-byte length-prefix framing over ZT connections - auth/hanzo/: Hanzo IAM JWT credential resolution (env + auth file) - billing/: Commerce API billing guard with balance check and usage recording (no free tier)
27 lines
556 B
Go
27 lines
556 B
Go
package billing
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestInsufficientBalanceError(t *testing.T) {
|
|
err := &InsufficientBalanceError{
|
|
Service: "test-svc",
|
|
Balance: -5.0,
|
|
}
|
|
msg := err.Error()
|
|
if msg == "" {
|
|
t.Error("expected non-empty error message")
|
|
}
|
|
if err.Service != "test-svc" {
|
|
t.Errorf("expected service 'test-svc', got '%s'", err.Service)
|
|
}
|
|
}
|
|
|
|
func TestDefaultGuard(t *testing.T) {
|
|
g := DefaultGuard("test-token")
|
|
if g.commerceURL != "https://api.hanzo.ai/commerce" {
|
|
t.Errorf("expected default commerce URL, got '%s'", g.commerceURL)
|
|
}
|
|
}
|