Migrate repo fixtures to separated prompts/ and execution profiles/ with file-backed prompt templates
This commit is contained in:
@@ -2,7 +2,6 @@ package usecase
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
@@ -27,24 +26,21 @@ func (f *integrationLLM) Generate(ctx context.Context, req domain.GenerateReques
|
||||
}, nil
|
||||
}
|
||||
|
||||
func TestRunnerIntegrationWithProfilesFixturesAndValidation(t *testing.T) {
|
||||
func TestRunnerIntegrationWithPromptAndProfileFixturesAndValidation(t *testing.T) {
|
||||
root, err := filepath.Abs(filepath.Join("..", ".."))
|
||||
if err != nil {
|
||||
t.Fatalf("failed to resolve repo root: %v", err)
|
||||
}
|
||||
|
||||
promptsDir := filepath.Join(root, "prompts")
|
||||
profilesDir := filepath.Join(root, "profiles")
|
||||
execProfilesDir := t.TempDir()
|
||||
schemasDir := filepath.Join(root, "schemas")
|
||||
fixturesDir := filepath.Join(root, "examples", "fixtures")
|
||||
if err := os.WriteFile(filepath.Join(execProfilesDir, "local-default.yaml"), []byte(
|
||||
"id: local-default\nendpoint: http://llm/v1\nmodel: test-model\n"), 0644); err != nil {
|
||||
t.Fatalf("failed to write execution profile fixture: %v", err)
|
||||
}
|
||||
t.Setenv("SCRIPTORIUM_API_KEY", "test-key")
|
||||
|
||||
runner := NewRunner(
|
||||
promptdef.NewFilesystemRepository(profilesDir),
|
||||
profile.NewFilesystemRepository(execProfilesDir),
|
||||
promptdef.NewFilesystemRepository(promptsDir),
|
||||
profile.NewFilesystemRepository(profilesDir),
|
||||
artifact.NewCompositeReader(),
|
||||
prompt.NewGoRenderer(),
|
||||
&integrationLLM{},
|
||||
@@ -52,8 +48,7 @@ func TestRunnerIntegrationWithProfilesFixturesAndValidation(t *testing.T) {
|
||||
)
|
||||
|
||||
res, err := runner.Run(context.Background(), domain.RunRequest{
|
||||
PromptID: "generic.structured_events",
|
||||
ProfileID: "local-default",
|
||||
PromptID: "generic.structured_events",
|
||||
Inputs: map[string]domain.ArtifactRef{
|
||||
"transcript": {
|
||||
Type: domain.ArtifactRefFile,
|
||||
@@ -72,6 +67,9 @@ func TestRunnerIntegrationWithProfilesFixturesAndValidation(t *testing.T) {
|
||||
if res.PromptID != "generic.structured_events" {
|
||||
t.Fatalf("unexpected prompt id: %q", res.PromptID)
|
||||
}
|
||||
if res.SelectedProfileID != "local-quality" {
|
||||
t.Fatalf("expected selected profile local-quality from prompt default, got %q", res.SelectedProfileID)
|
||||
}
|
||||
if res.RunID == "" {
|
||||
t.Fatal("expected run id")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user