Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package billing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestSalesQuoteCancelAt(t *testing.T) {
|
||||
now := time.Date(2026, 8, 8, 12, 0, 0, 0, time.UTC)
|
||||
got, err := salesQuoteCancelAt(now, 4, "month")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := time.Date(2026, 12, 8, 12, 0, 0, 0, time.UTC)
|
||||
if !got.Equal(want) {
|
||||
t.Fatalf("month cancel_at = %v, want %v", got, want)
|
||||
}
|
||||
got, err = salesQuoteCancelAt(now, 2, "quarter")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want = time.Date(2027, 2, 8, 12, 0, 0, 0, time.UTC)
|
||||
if !got.Equal(want) {
|
||||
t.Fatalf("quarter cancel_at = %v, want %v", got, want)
|
||||
}
|
||||
got, err = salesQuoteCancelAt(now, 1, "year")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want = time.Date(2027, 8, 8, 12, 0, 0, 0, time.UTC)
|
||||
if !got.Equal(want) {
|
||||
t.Fatalf("year cancel_at = %v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStripeRecurringFromInstallment(t *testing.T) {
|
||||
iv, n, err := stripeRecurringFromInstallment("quarter")
|
||||
if err != nil || iv != "month" || n != 3 {
|
||||
t.Fatalf("quarter => %s/%d err=%v", iv, n, err)
|
||||
}
|
||||
iv, n, err = stripeRecurringFromInstallment("month")
|
||||
if err != nil || iv != "month" || n != 1 {
|
||||
t.Fatalf("month => %s/%d err=%v", iv, n, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user