2a29104412
Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com> Co-authored-by: Henry <nova28@users.noreply.github.com> Co-authored-by: nova28 <17953305+nova28@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: João Salavisa <joao.salavisa@gmail.com> Co-authored-by: Kandev Agent <agent@kandev.dev>
30 lines
746 B
Go
30 lines
746 B
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/kandev/kandev/internal/testutil"
|
|
)
|
|
|
|
func TestPostgresRepository_ListPromptsForReferenceExpansion(t *testing.T) {
|
|
database := testutil.OpenIsolatedPostgres(t, testutil.PostgresDSNFromEnv(t))
|
|
repo, err := newSQLiteRepositoryWithDB(database, database)
|
|
if err != nil {
|
|
t.Fatalf("initialize prompts repository: %v", err)
|
|
}
|
|
|
|
prompts, truncated, err := repo.ListPromptsForReferenceExpansion(
|
|
context.Background(), 20, 512, 1<<20, 1<<20, 16<<20,
|
|
)
|
|
if err != nil {
|
|
t.Fatalf("list prompts for reference expansion: %v", err)
|
|
}
|
|
if truncated {
|
|
t.Fatal("expected seeded prompts to fit within the candidate limit")
|
|
}
|
|
if len(prompts) == 0 {
|
|
t.Fatal("expected seeded prompts")
|
|
}
|
|
}
|