@@ -321,5 +321,41 @@ fn test_create_prompt_with_content_command() -> Result<(), Box<dyn std::error::E
321321 // Release the lock before cleanup
322322 drop ( chat) ;
323323
324+ Ok ( ( ) )
325+ }
326+
327+ #[ test]
328+ #[ cfg( all( feature = "ai_prompts" , feature = "sanity" ) ) ]
329+ fn test_create_prompt_with_content_global_command ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
330+ println ! ( "\n 🔍 Testing /prompts create --name promptname --content -global command... | Description: Tests the <code> /prompts create --name promptname --content prompt-content --global</code> command create a new global prompt with prompt content." ) ;
331+
332+ let session = q_chat_helper:: get_chat_session ( ) ;
333+ let mut chat = session. lock ( ) . unwrap_or_else ( |poisoned| poisoned. into_inner ( ) ) ;
334+
335+ let response = chat. execute_command_with_timeout ( "/prompts create --name promptglobaltest --content 'What is java' --global" , Some ( 2000 ) ) ?;
336+ println ! ( "📝 FULL OUTPUT:" ) ;
337+ println ! ( "{}" , response) ;
338+ println ! ( "📝 END OUTPUT" ) ;
339+
340+ assert ! ( response. contains( "Created global prompt" ) , "Expected 'Created global prompt' in response." ) ;
341+ assert ! ( response. contains( "✓" ) , "Expected '✓' in response." ) ;
342+
343+ //delete created prompt
344+ let remove_response = chat. execute_command_with_timeout ( "/prompts remove promptglobaltest --global" , Some ( 2000 ) ) ?;
345+ println ! ( "Remove Response: {}" , remove_response) ;
346+ if remove_response. contains ( "Are you sure you want to remove this prompt? (y/n):" ) {
347+ chat. send_key_input ( "y" ) ?;
348+ println ! ( "Now removing the created prompt" ) ;
349+ let enter_response = chat. send_key_input ( "\r " ) ?;
350+ if enter_response. contains ( "Removed" ) || enter_response. contains ( "successfully" ) {
351+ println ! ( "📝 Created prompt removed successfully!" ) ;
352+ } else {
353+ println ! ( "📝 Unable to remove the created prompt." ) ;
354+ }
355+ }
356+ println ! ( "✅ /prompts create --name --content --global command functionality verified!" ) ;
357+ // Release the lock before cleanup
358+ drop ( chat) ;
359+
324360 Ok ( ( ) )
325361}
0 commit comments