42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package e2estack
|
|
|
|
import (
|
|
"context"
|
|
"github.com/tradarr/backend/internal/scraper"
|
|
"github.com/tradarr/backend/internal/summarybudget"
|
|
"testing"
|
|
)
|
|
|
|
func TestTicket39FakeScraperDeclaresCompleteEditorialContent(t *testing.T) {
|
|
f := NewFakes()
|
|
base, closeServer, err := Listen(f.Handler())
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer closeServer()
|
|
articles, err := (FakeScraper{URL: base, Client: LoopbackClient()}).Scrape(context.Background(), []string{"FIX"})
|
|
if err != nil || len(articles) != 1 {
|
|
t.Fatal("fixture scrape failed", err)
|
|
}
|
|
if articles[0].ContentState != scraper.ContentComplete || scraper.ContentStatus(articles[0]) != scraper.ContentComplete {
|
|
t.Fatal("fixture editorial body is not explicitly complete")
|
|
}
|
|
}
|
|
func TestTicket39FakeSummaryProfileIsExplicitAndNotInProductionRegistry(t *testing.T) {
|
|
if _, ok := summarybudget.Lookup("ollama", "fake-summary"); ok {
|
|
t.Fatal("fake capacity leaked into production registry")
|
|
}
|
|
p, ok := FixtureSummaryProfile("ollama", "fake-summary")
|
|
if !ok {
|
|
t.Fatal("fixture capacity missing")
|
|
}
|
|
if _, err := p.Measure("fixture prompt", 250000); err != nil {
|
|
t.Fatal("fixture profile invalid", err)
|
|
}
|
|
for _, pair := range [][2]string{{"openai", "fake-summary"}, {"ollama", "unknown"}} {
|
|
if _, ok := FixtureSummaryProfile(pair[0], pair[1]); ok {
|
|
t.Fatal("fixture profile accepted unknown model")
|
|
}
|
|
}
|
|
}
|