Files
descrybe/apps/api/internal/woocommerce/orders_reviews_test.go
T
greeneclipse 8580c996c3 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.
2026-08-09 22:47:43 +02:00

36 lines
752 B
Go

package woocommerce
import (
"encoding/json"
"testing"
)
func TestExtractItemCategories(t *testing.T) {
meta, _ := json.Marshal([]map[string]any{
{"key": "categories", "value": []any{"Shoes", "Men"}},
{"key": "foo", "value": "bar"},
})
item := OrderLineItem{MetaData: meta}
got := extractItemCategories(item)
if len(got) != 2 {
t.Fatalf("expected 2 categories, got %#v", got)
}
}
func TestParseWooTime(t *testing.T) {
if parseWooTime("2024-01-02T03:04:05") == nil {
t.Fatal("expected parsed time")
}
if parseWooTime("") != nil {
t.Fatal("expected nil")
}
}
func TestClampPerPage(t *testing.T) {
if clampPerPage(0) != defaultListPerPage {
t.Fatal("default")
}
if clampPerPage(500) != maxListPerPage {
t.Fatal("max")
}
}