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,36 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user