Return subscription from channel-preview [skip-tests]
All checks were successful
Build Docker and Deploy / Run Unit-Tests (push) Has been skipped
Build Docker and Deploy / Build Docker Container (push) Successful in 46s
Build Docker and Deploy / Deploy to Server (push) Successful in 6s

This commit is contained in:
2025-04-12 23:37:06 +02:00
parent 301240b896
commit c0b8a8a3f4
6 changed files with 217 additions and 6 deletions

View File

@@ -306,6 +306,22 @@ func AssertAny(v any) {
// used to prevent golang "unused variable error"
}
func AssertNil(t *testing.T, key string, v any) {
if v != nil {
t.Errorf("AssertNil(%s) failed - actual value:\n%+v", key, v)
t.Error(string(debug.Stack()))
t.FailNow()
}
}
func AssertNotNil(t *testing.T, key string, v any) {
if v == nil {
t.Errorf("AssertNotNil(%s) failed", key)
t.Error(string(debug.Stack()))
t.FailNow()
}
}
func unpointer(v any) any {
if v == nil {
return v

View File

@@ -125,6 +125,18 @@ func assertjsonStructureMatchSingleValue(t *testing.T, strschema string, realVal
t.Errorf("Key < %s > is not a int (its actually %T: '%v')", keyPath, realValue, realValue)
return
}
case "object|null":
if langext.IsNil(realValue) {
return // OK
}
if _, ok := realValue.(map[string]any); !ok {
t.Errorf("Key < %s > is not an object|null (its actually %T: '%v')", keyPath, realValue, realValue)
return
}
if _, err := time.Parse(time.RFC3339, realValue.(string)); err != nil {
t.Errorf("Key < %s > is not an object|null (its '%v')", keyPath, realValue)
return
}
default:
t.Errorf("Unknown schema type '%s' for key < %s >", strschema, keyPath)
return