feat: Refine trail category model (#1059)
* feat: advanced trail categories * rename remote_category * fix merge issues * subcategories for plugins mapping * fix refresh * remove vertical trail filter category scrolling * cleanup * add confirm modal for disabling a category * Fix federation issues * fix review findings * redesign category settings page * remove prio badge * fix subcategory badge layout * optimize subcategory settings layout * further settings page layout optimization * fix subcategory icon position * fix * update docs --------- Co-authored-by: Christian Beutel <>
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package routes
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"pocketbase/plugins/importer"
|
||||
)
|
||||
|
||||
func TestCategoryMappingPreservesExplicitEmptyMap(t *testing.T) {
|
||||
mapping := categoryMapping(map[string]any{
|
||||
@@ -29,7 +33,22 @@ func TestCategoryMappingPreservesBlankProviderMapping(t *testing.T) {
|
||||
if mapping == nil {
|
||||
t.Fatal("expected category mapping")
|
||||
}
|
||||
if value, ok := mapping["Ride"]; !ok || value != "" {
|
||||
if value, ok := mapping["Ride"]; !ok || value != (importer.CategoryMappingValue{}) {
|
||||
t.Fatalf("expected blank provider mapping to be preserved, got %#v", mapping)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCategoryMappingParsesStructuredTarget(t *testing.T) {
|
||||
mapping := categoryMapping(map[string]any{
|
||||
"categoryMapping": map[string]any{
|
||||
"TrailRun": map[string]any{
|
||||
"category": "Running",
|
||||
"subcategory": "Trail",
|
||||
},
|
||||
},
|
||||
})
|
||||
want := importer.CategoryMappingValue{Category: "Running", Subcategory: "Trail"}
|
||||
if value, ok := mapping["TrailRun"]; !ok || value != want {
|
||||
t.Fatalf("structured provider mapping = %#v, want %#v", mapping, want)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user