1+ use q_cli_e2e_tests:: q_chat_helper;
2+
3+ /// Tests the 'q settings --format' subcommand with the following:
4+ /// - Verifies that the command returns a non-empty response
5+ /// - Checks that the response contains the expected JSON-formatted setting value
6+ /// - Validates that the setting name is referenced in the output
7+ /// - Uses json-pretty format to display the chat.defaultAgent setting
8+ #[ test]
9+ #[ cfg( all( feature = "q_subcommand" , feature = "sanity" ) ) ]
10+ fn test_q_setting_format_subcommand ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
11+
12+ println ! ( "\n 🔍 Testing q settings --format <FORMAT> <SETTINGS>... | Description: Tests the q settings --FORMAT <FORMAT> <SETTINGS> subcommand to validate FORMAT content." ) ;
13+ let response = q_chat_helper:: execute_q_subcommand ( "q" , & [ "settings" , "--format" , "json-pretty" , "chat.defaultAgent" ] ) ?;
14+
15+ println ! ( "📝 transform response: {} bytes" , response. len( ) ) ;
16+ println ! ( "📝 FULL OUTPUT:" ) ;
17+ println ! ( "{}" , response) ;
18+ println ! ( "📝 END OUTPUT" ) ;
19+
20+ assert ! ( !response. is_empty( ) , "Expected non-empty response" ) ;
21+ assert ! ( response. contains( "\" q_cli_default\" " ) , "Expected JSON-formatted setting value" ) ;
22+ assert ! ( response. contains( "chat.defaultAgent" ) , "Expected command to reference the setting name" ) ;
23+
24+ Ok ( ( ) )
25+ }
26+ #[ test]
27+ #[ cfg( all( feature = "q_subcommand" , feature = "sanity" ) ) ]
28+ fn test_q_setting_format_subcommand ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
29+
30+ println ! ( "\n 🔍 Testing q settings --format <FORMAT> <SETTINGS>... | Description: Tests the q settings --FORMAT <FORMAT> <SETTINGS> subcommand to validate FORMAT content." ) ;
31+ let response = q_chat_helper:: execute_q_subcommand ( "q" , & [ "settings" , "--format" , "json-pretty" , "chat.defaultAgent" ] ) ?;
32+
33+ println ! ( "📝 transform response: {} bytes" , response. len( ) ) ;
34+ println ! ( "📝 FULL OUTPUT:" ) ;
35+ println ! ( "{}" , response) ;
36+ println ! ( "📝 END OUTPUT" ) ;
37+
38+ assert ! ( !response. is_empty( ) , "Expected non-empty response" ) ;
39+ assert ! ( response. contains( "\" q_cli_default\" " ) , "Expected JSON-formatted setting value" ) ;
40+ assert ! ( response. contains( "chat.defaultAgent" ) , "Expected command to reference the setting name" ) ;
41+
42+ Ok ( ( ) )
43+ }
0 commit comments