package model import ( "testing" "os" "fmt" "path/filepath" ) func TestRecipesRead(t *testing.T) { storagePath, err := os.MkdirTemp("", "ceres") if err != nil { fmt.Println("Error creating temporary directory:", err) return } t.Logf("Storage path: %v\n", storagePath) defer os.RemoveAll(storagePath) storage := NewStorage(storagePath) ConnectDatabase(filepath.Join(storage.Path, "ceres.sqlite3")) defer DisconnectDatabase() MigrateDatabase("dummy_version") InjectTestRecipes() r := make(Recipes, 0) err = r.Read() if err != nil { t.Fatalf("Failed to read Recipes: %v\n", err) } if len(r) != 2 { // TODO this needs to be aligned with model/testrecipes.go t.Fatalf("Expected a list of one recipe but got %d", len(r)) } }