package discovery import ( "context" "testing" "time" "supply-intelligence/internal/domain" "supply-intelligence/internal/repository" ) func TestListCandidatesRejectsLegacyPendingAdmissionAssumption(t *testing.T) { repo := repository.NewMemoryRepository() repo.UpsertDiscoveryCandidateContext(context.Background(), domain.DiscoveryCandidate{ CandidateID: "cand-discovered", AccountID: 10, Platform: "openai", Model: "gpt-4.1-mini", Source: "seed", Status: domain.DiscoveryCandidateStatusDiscovered, DiscoveredAt: time.Unix(100, 0).UTC(), UpdatedAt: time.Unix(100, 0).UTC(), Version: 1, }) repo.UpsertDiscoveryCandidateContext(context.Background(), domain.DiscoveryCandidate{ CandidateID: "cand-tested", AccountID: 11, Platform: "openai", Model: "gpt-4.1", Source: "seed", Status: domain.DiscoveryCandidateStatusTestPassed, DiscoveredAt: time.Unix(200, 0).UTC(), UpdatedAt: time.Unix(200, 0).UTC(), Version: 1, }) service := NewService(repo) items := service.ListCandidates(context.Background(), domain.DiscoveryCandidateStatusDiscovered) if len(items) != 1 || items[0].CandidateID != "cand-discovered" { t.Fatalf("unexpected filtered items: %+v", items) } }