package tender import ( "testing" "go.mongodb.org/mongo-driver/v2/bson" ) func TestBuildSearchFilterDocumentsScrapedWithoutFolderIDsMatchesNothing(t *testing.T) { repo := &tenderRepository{} filter := repo.buildSearchFilter(&SearchForm{DocumentsScraped: true}) in, ok := filter["contract_folder_id"].(bson.M)["$in"].([]string) if !ok || len(in) != 0 { t.Fatalf("expected empty contract_folder_id $in filter, got %#v", filter) } } func TestTenderSearchListProjectionExcludesHeavyFields(t *testing.T) { projection := tenderSearchListProjection() for _, field := range []string{ "content_xml", "description", "ai_overall_summary", "procurement_lots", "document_summaries", } { if projection[field] != 0 { t.Fatalf("expected %s to be excluded from list projection", field) } } }