feat(summary): send complete articles within user budget (#39)
This commit is contained in:
41
backend/internal/e2estack/content_ticket39_test.go
Normal file
41
backend/internal/e2estack/content_ticket39_test.go
Normal file
@ -0,0 +1,41 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user