diff options
Diffstat (limited to 'model/recipes_test.go')
| -rw-r--r-- | model/recipes_test.go | 24 | 
1 files changed, 24 insertions, 0 deletions
diff --git a/model/recipes_test.go b/model/recipes_test.go new file mode 100644 index 0000000..1d9eda1 --- /dev/null +++ b/model/recipes_test.go @@ -0,0 +1,24 @@ +package model + +import ( +	"testing" +) + +func TestRecipesRead(t *testing.T) { +	InitStorage() +	defer RemoveStorage() + +	InitDatabase() +	defer CloseDatabase() + +	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/sql/testdata.sql +		t.Fatalf("Expected a list of one recipe but got %d", len(r)) +	} +}  | 
