@@ -3342,9 +3342,21 @@ describe("PiAdapterV2", () => {
33423342 } ) . pipe ( Effect . scoped , Effect . provide ( layerTest ) ) ,
33433343 ) ;
33443344
3345- it . effect . each ( [ undefined , "" , "1,3; custom answer" ] ) (
3345+ it . effect . each ( [
3346+ {
3347+ placeholder : undefined ,
3348+ title : "Enter <branch> & [name] *exact*" ,
3349+ question : String . raw `Enter <branch> & \[name\] \*exact\*` ,
3350+ } ,
3351+ {
3352+ placeholder : "" ,
3353+ title : "Where should this run?\n1. Current branch\n2. New worktree" ,
3354+ question : "Where should this run?\n1\\. Current branch\n2\\. New worktree" ,
3355+ } ,
3356+ { placeholder : "1,3; custom answer" , title : "Enter a value" , question : "Enter a value" } ,
3357+ ] ) (
33463358 "maps native text input without turning its placeholder into an answer, placeholder=%s" ,
3347- ( placeholder ) =>
3359+ ( { placeholder, title , question : expectedQuestion } ) =>
33483360 Effect . gen ( function * ( ) {
33493361 const fake = yield * makeFakePi ;
33503362 const { runtime, takeEvent } = yield * openRuntime ( fake ) ;
@@ -3353,7 +3365,6 @@ describe("PiAdapterV2", () => {
33533365 modelSelection : modelSelection ( "default" ) ,
33543366 runtimePolicy,
33553367 } ) ;
3356- const title = "Where should this run?\n1. Current branch\n2. New worktree" ;
33573368 for ( const [ index , answer ] of [ "" , " exact answer\n" ] . entries ( ) ) {
33583369 const id = `ui-input-${ index } ` ;
33593370 yield * fake . emit ( {
@@ -3375,7 +3386,7 @@ describe("PiAdapterV2", () => {
33753386 }
33763387 const [ question ] = decodeUserInputQuestions ( event . turnItem . questions ) ;
33773388 assert . equal ( question ?. header , "Question" ) ;
3378- assert . equal ( question ?. question , title ) ;
3389+ assert . equal ( question ?. question , expectedQuestion ) ;
33793390 assert . deepEqual ( question ?. options , [ ] ) ;
33803391 assert . equal ( question ?. initialAnswer , "" ) ;
33813392 assert . equal ( question ?. placeholder , placeholder ) ;
@@ -3414,7 +3425,10 @@ describe("PiAdapterV2", () => {
34143425 if ( event . type !== "turn_item.updated" || event . turnItem . type !== "user_input_request" ) {
34153426 return assert . fail ( "expected a user input request" ) ;
34163427 }
3417- assert . equal ( decodeUserInputQuestions ( event . turnItem . questions ) [ 0 ] ?. question , title ) ;
3428+ assert . equal (
3429+ decodeUserInputQuestions ( event . turnItem . questions ) [ 0 ] ?. question ,
3430+ "Which database?\n1\\. Postgres\n2\\. Type something\\.\nType your answer:" ,
3431+ ) ;
34183432 yield * runtime . respondToRuntimeRequest ( {
34193433 requestId : event . turnItem . requestId ,
34203434 answers : { "ui-input" : "SQLite" } ,
0 commit comments