big tings

This commit is contained in:
Max Richter
2025-08-17 15:16:17 +02:00
parent 40b9be887d
commit c687eff53d
958 changed files with 32279 additions and 704 deletions

View File

@@ -0,0 +1,38 @@
package registry_test
import (
"testing"
"git.max-richter.dev/max/marka/registry"
)
func TestValidateRecipe_InvalidType(t *testing.T) {
recipe := map[string]any{
"@type": "Recipe",
"recipeYield": 4,
"recipeIngredient": []string{
"500 g flour",
"300 ml water",
},
"recipeInstructions": "Mix and bake.",
}
if err := registry.ValidateSchema(recipe, "schema:Recipe"); err == nil {
t.Fatalf("expected validation error for invalid recipe, got nil")
}
}
func TestValidateRecipe_Valid(t *testing.T) {
recipe := map[string]any{
"@type": "Recipe",
"name": "Simple Bread",
"cookTime": "PT30M",
"recipeIngredient": []any{"500 g flour", "300 ml water", "10 g salt", "3 g yeast"},
"recipeInstructions": "Mix ingredients, let dough rise, bake at 220°C for 35 minutes.",
"recipeYield": "1 loaf",
}
if err := registry.ValidateSchema(recipe, "schema:Recipe"); err != nil {
t.Fatalf("expected valid recipe, got error: %v", err)
}
}