Move all business-logic packages from internal/ root into internal/domain/: auth, cuisine, diary, dish, home, ingredient, language, menu, product, recipe, recognition, recommendation, savedrecipe, tag, units, user Rename model.go → entity.go in packages that hold domain entities: diary, dish, home, ingredient, menu, product, recipe, savedrecipe, user Update all import paths accordingly (adapters, infra/server, cmd/server, tests). No logic changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
800 B
Go
37 lines
800 B
Go
//go:build integration
|
|
|
|
package recipe_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/food-ai/backend/internal/domain/recipe"
|
|
"github.com/food-ai/backend/internal/testutil"
|
|
)
|
|
|
|
func TestRecipeRepository_GetByID_NotFound(t *testing.T) {
|
|
pool := testutil.SetupTestDB(t)
|
|
repo := recipe.NewRepository(pool)
|
|
ctx := context.Background()
|
|
|
|
got, getError := repo.GetByID(ctx, "00000000-0000-0000-0000-000000000000")
|
|
if getError != nil {
|
|
t.Fatalf("unexpected error: %v", getError)
|
|
}
|
|
if got != nil {
|
|
t.Error("expected nil for non-existent ID")
|
|
}
|
|
}
|
|
|
|
func TestRecipeRepository_Count(t *testing.T) {
|
|
pool := testutil.SetupTestDB(t)
|
|
repo := recipe.NewRepository(pool)
|
|
ctx := context.Background()
|
|
|
|
_, countError := repo.Count(ctx)
|
|
if countError != nil {
|
|
t.Fatalf("count: %v", countError)
|
|
}
|
|
}
|