package runner import ( "errors" "testing" "time" "github.com/easyai/easyai-ai-gateway/apps/api/internal/store" ) func TestBillingSettlementRetryDelay(t *testing.T) { t.Parallel() tests := []struct { attempt int want time.Duration }{ {attempt: 1, want: time.Second}, {attempt: 2, want: 2 * time.Second}, {attempt: 10, want: 512 * time.Second}, {attempt: 11, want: 15 * time.Minute}, {attempt: 20, want: 15 * time.Minute}, } for _, test := range tests { if got := billingSettlementRetryDelay(test.attempt); got != test.want { t.Fatalf("attempt %d: got %s, want %s", test.attempt, got, test.want) } } } func TestBillingSettlementErrorCode(t *testing.T) { t.Parallel() if got := billingSettlementErrorCode(store.ErrInsufficientWalletBalance); got != "insufficient_balance" { t.Fatalf("got %q", got) } if got := billingSettlementErrorCode(errors.New("boom")); got != "settlement_failed" { t.Fatalf("got %q", got) } }