Files
honeyDueAPI/internal/repositories/document_repo_test.go
Trey t 4976eafc6c Rebrand from Casera/MyCrib to honeyDue
Total rebrand across all Go API source files:
- Go module path: casera-api -> honeydue-api
- All imports updated (130+ files)
- Docker: containers, images, networks renamed
- Email templates: support email, noreply, icon URL
- Domains: casera.app/mycrib.treytartt.com -> honeyDue.treytartt.com
- Bundle IDs: com.tt.casera -> com.tt.honeyDue
- IAP product IDs updated
- Landing page, admin panel, config defaults
- Seeds, CI workflows, Makefile, docs
- Database table names preserved (no migration needed)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 06:33:38 -06:00

39 lines
1.1 KiB
Go

package repositories
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/treytartt/honeydue-api/internal/models"
"github.com/treytartt/honeydue-api/internal/testutil"
)
func TestDocumentRepository_FindByUser_HasDefaultLimit(t *testing.T) {
db := testutil.SetupTestDB(t)
repo := NewDocumentRepository(db)
user := testutil.CreateTestUser(t, db, "owner", "owner@test.com", "password")
residence := testutil.CreateTestResidence(t, db, user.ID, "Test House")
// Create 510 documents to exceed the default limit of 500
for i := 0; i < 510; i++ {
doc := &models.Document{
ResidenceID: residence.ID,
CreatedByID: user.ID,
Title: fmt.Sprintf("Doc %d", i+1),
DocumentType: models.DocumentTypeGeneral,
FileURL: "https://example.com/doc.pdf",
IsActive: true,
}
err := db.Create(doc).Error
require.NoError(t, err)
}
docs, err := repo.FindByUser([]uint{residence.ID})
require.NoError(t, err)
assert.Equal(t, 500, len(docs), "FindByUser should return at most 500 documents by default")
}