feat(generation): persist summary outcomes without articles
Record generation outcomes and summaries for history while keeping article content transient. Refs #7 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
35
backend/internal/scheduler/generation_test.go
Normal file
35
backend/internal/scheduler/generation_test.go
Normal file
@ -0,0 +1,35 @@
|
||||
package scheduler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/tradarr/backend/internal/generation"
|
||||
"github.com/tradarr/backend/internal/models"
|
||||
)
|
||||
|
||||
type scheduledUsers struct{}
|
||||
|
||||
func (scheduledUsers) ListUsers() ([]models.User, error) {
|
||||
return []models.User{{ID: "alpha"}, {ID: "beta"}}, nil
|
||||
}
|
||||
|
||||
type scheduledGenerator struct{ ids []string }
|
||||
|
||||
func (g *scheduledGenerator) Generate(_ context.Context, id string) (generation.Result, error) {
|
||||
g.ids = append(g.ids, id)
|
||||
if id == "alpha" {
|
||||
return generation.Result{}, errors.New("failure")
|
||||
}
|
||||
return generation.Result{}, nil
|
||||
}
|
||||
func TestScheduledGenerationContinuesIndependentlyPerUser(t *testing.T) {
|
||||
g := &scheduledGenerator{}
|
||||
s := &Scheduler{users: scheduledUsers{}, generationUseCase: g}
|
||||
s.run()
|
||||
if !reflect.DeepEqual(g.ids, []string{"alpha", "beta"}) {
|
||||
t.Fatalf("scheduled identities=%v", g.ids)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user