test(09-04): add failing tests for typed list filters

- Switch, date-range, and model-scope filters must keep typed values
- Option labels localize without changing identifiers or cached keys
- Raw conditions, unknown scopes, and arbitrary methods fail activation
This commit is contained in:
Jakub Zych
2026-09-24 18:50:17 +02:00
parent aab4398ce4
commit cb832eb70c
3 changed files with 328 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package cabana
import (
"context"
"fmt"
"io/fs"
"path"
@@ -9,6 +10,7 @@ import (
"time"
"git.golem15.com/golem15/summercms/pact"
"git.golem15.com/golem15/summercms/phrasebook"
"github.com/goccy/go-yaml"
"gorm.io/gorm"
)
@@ -351,3 +353,17 @@ func isListRelation(t reflect.Type) bool {
}
return true
}
// Localize copies the cached list schema for one request.
// The RED seam returns source keys; request-time translation replaces this body.
func (s *ListSchema) Localize(ctx context.Context, tr *phrasebook.Translator) (*ListSchema, error) {
if s == nil {
return nil, fmt.Errorf("cabana: nil list schema")
}
if ctx == nil {
ctx = context.Background()
}
out := *s
_ = tr
return &out, nil
}