2026-08-05 19:13:37 +00:00
package locationregistry
2026-08-04 00:02:18 +00:00
import (
"context"
2026-08-05 19:13:37 +00:00
"strings"
2026-08-04 00:02:18 +00:00
"testing"
"time"
"gitea.maximumdirect.net/eric/notarius/internal/framework/llm"
"gitea.maximumdirect.net/eric/promptkit"
)
func TestRegisterPromptAssetsPreparesLocationPrompt ( t * testing . T ) {
registry := llm . NewAssetRegistry ( )
if err := RegisterPromptAssets ( registry ) ; err != nil {
t . Fatalf ( "RegisterPromptAssets() error = %v" , err )
}
options , err := registry . PromptKitOptions ( )
if err != nil {
t . Fatalf ( "PromptKitOptions() error = %v" , err )
}
options = append ( options , promptkit . WithProfiles ( promptkit . OpenAICompatibleProfile ( promptkit . OpenAICompatibleProfileConfig { ID : "location-test-profile" , Endpoint : "http://127.0.0.1:1/v1" , Model : "location-test-model" } ) ) )
engine , err := promptkit . NewEngine ( promptkit . Config { Timeout : time . Second } , options ... )
if err != nil {
t . Fatalf ( "NewEngine() error = %v" , err )
}
prepared , err := engine . Prepare ( context . Background ( ) , promptkit . RunRequest { PromptID : PromptID , PromptVersion : SchemaVersion , ProfileID : "location-test-profile" , Inputs : map [ string ] promptkit . ArtifactRef {
2026-08-05 14:48:55 +00:00
"transcript" : promptkit . Inline ( ` { "units":[ { "sentinel":"location-transcript"}]} ` ) , "players" : promptkit . Inline ( "location-player" ) , "party" : promptkit . Inline ( " " ) , "glossary" : promptkit . Inline ( " " ) ,
2026-08-04 00:02:18 +00:00
} } )
if err != nil {
t . Fatalf ( "Prepare() error = %v" , err )
}
2026-08-05 19:13:37 +00:00
if prepared . PromptID != PromptID || prepared . OutputContract . SchemaPath != "dnd_location_registry_llm.v1.json" {
2026-08-05 17:38:51 +00:00
t . Fatalf ( "prepared prompt = %#v, want location prompt identity and schema wiring" , prepared )
2026-08-05 14:48:55 +00:00
}
2026-08-05 19:13:37 +00:00
content := make ( [ ] string , len ( prepared . Messages ) )
for index , message := range prepared . Messages {
content [ index ] = message . Content
}
rendered := strings . Join ( content , "\n" )
if ! strings . Contains ( rendered , "stable proper name or unique in-world designation" ) || ! strings . Contains ( rendered , "the room" ) || ! strings . Contains ( rendered , "Do not use capitalization as an eligibility test" ) {
t . Fatalf ( "rendered prompt = %q, want named-or-unique location eligibility rules" , rendered )
}
2026-08-04 00:02:18 +00:00
}