package adapters import ( "context" "errors" "testing" oppintel "github.com/missionworkforce/missionmatch/internal/modules/opportunity_intelligence" ) // TestCommercialStubsAreSourcesButMakeNoCall proves each deferred feed implements the OpportunitySource // protocol, returns its documented not enabled error, and yields no records (no live call). func TestCommercialStubsAreSourcesButMakeNoCall(t *testing.T) { var ( _ oppintel.OpportunitySource = GovWinIQSource{} _ oppintel.OpportunitySource = GovTribeSource{} _ oppintel.OpportunitySource = NewEBuySource("org-1") ) yielded := 0 sink := func(oppintel.OpportunityRecord) error { yielded++; return nil } if err := (GovWinIQSource{}).Fetch(context.Background(), sink); !errors.Is(err, ErrRequiresLicense) { t.Fatalf("GovWin IQ: want ErrRequiresLicense, got %v", err) } if err := (GovTribeSource{}).Fetch(context.Background(), sink); !errors.Is(err, ErrRequiresLicense) { t.Fatalf("GovTribe: want ErrRequiresLicense, got %v", err) } if err := NewEBuySource("org-1").Fetch(context.Background(), sink); !errors.Is(err, ErrRequiresTenantCredential) { t.Fatalf("eBuy: want ErrRequiresTenantCredential, got %v", err) } if yielded != 0 { t.Fatalf("a stub must yield no records (no live call), got %d", yielded) } } func TestStubNames(t *testing.T) { govwin := GovWinIQSource{}.Name() govtribe := GovTribeSource{}.Name() ebuy := NewEBuySource("x").Name() if govwin != "GovWin IQ" { t.Fatalf("GovWin name = %q", govwin) } if govtribe != "GovTribe" { t.Fatalf("GovTribe name = %q", govtribe) } if ebuy != "GSA eBuy" { t.Fatalf("eBuy name = %q", ebuy) } }