Skip to content

Commit 2dec2fb

Browse files
committed
Refactor assertions and cleanup in Kiro CLI tests for improved clarity and reliability and Fix the code causing warning during execution
1 parent c318cbe commit 2dec2fb

File tree

7 files changed

+16
-8
lines changed

7 files changed

+16
-8
lines changed

e2etests/tests/ai_prompts/test_prompts_commands.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ fn test_prompts_remove_command() -> Result<(), Box<dyn std::error::Error>> {
266266
println!("📝 END OUTPUT");
267267

268268
assert!(response.contains("Warning"), "Missing Warning");
269-
assert!(response.contains("This will permanently remove the local"), "Missing This will permanently remove the local message");
269+
assert!(response.contains("This will permanently remove the"), "Missing This will permanently remove the message");
270270
assert!(response.contains("testprompt"), "Missing testprompt");
271271

272272
let response = chat.send_key_input("y\r")?;
@@ -304,13 +304,11 @@ fn test_create_prompt_with_content_command() -> Result<(), Box<dyn std::error::E
304304
assert!(response.contains("Created local prompt"), "Expected 'Created local prompt' in response.");
305305
assert!(response.contains("✓"), "Expected '✓' in response.");
306306

307-
308-
309307
//delete created prompt
310308
let remove_response = chat.execute_command_with_timeout("/prompts remove promptlocaltest",Some(2000))?;
311309
println!("Remove Response: {}", remove_response);
312310
if remove_response.contains("Are you sure you want to remove this prompt? (y/n):") {
313-
let acknowledge_response = chat.send_key_input("y")?;
311+
chat.send_key_input("y")?;
314312
println!("Now removing the created prompt");
315313
let enter_response = chat.send_key_input("\r")?;
316314
if enter_response.contains("Removed") || enter_response.contains("successfully") {

e2etests/tests/kiro_cli_subcommand/test_kiro_cli_quit_subcommand.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ fn test_kiro_cli_quit_subcommand() -> Result<(), Box<dyn std::error::Error>> {
2828
println!("{}", quit_response);
2929
println!("📝 END OUTPUT");
3030

31-
assert!(quit_response.contains("Quitting Kiro CLI app"), "Missing Kiro CLI quit message");
31+
if quit_response.contains("restart Kiro CLI") {
32+
assert!(quit_response.contains("Please restart Kiro CLI from your host machine"),"Expected 'Please restart Kiro CLI from your host machine' in response.");
33+
} else {
34+
assert!(quit_response.contains("Quitting Kiro CLI app"),"Missing Quitting Kiro CLI app message");
35+
}
36+
37+
println!("✅ kiro-cli quit subcommand test passed.");
3238
Ok(())
3339

3440
}

e2etests/tests/kiro_cli_subcommand/test_kiro_cli_settings_delete_subcommand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn test_kiro_cli_settings_delete_subcommand() -> Result<(), Box<dyn std::error::
3232
// Verify deletion
3333
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["settings", key])?;
3434
println!("📝 Response: {}", response);
35-
assert!(response.contains("No value associated with chat.defaultAgent"), "Expected No value associated with chat.defaultAgent message in response");
35+
assert!(response.contains("No value associated with chat.defaultAgent"), "Expected No value associated with chat.defaultAgent message missing in response");
3636

3737
// Restore the setting
3838
let restore_response = q_chat_helper::execute_q_subcommand("kiro-cli", &["settings", key, value])?;

e2etests/tests/kiro_steering/test_kiro_global_steering.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#[allow(unused_imports)]
22
use q_cli_e2e_tests::q_chat_helper;
3+
#[allow(unused_imports)]
34
use std::fs;
45
#[allow(unused_imports)]
56
use std::env;
7+
#[allow(unused_imports)]
68
use std::path::PathBuf;
79

810
#[test]

e2etests/tests/kiro_steering/test_kiro_local_steering.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#[allow(unused_imports)]
22
use q_cli_e2e_tests::q_chat_helper;
3+
#[allow(unused_imports)]
34
use std::fs;
45
#[allow(unused_imports)]
56
use std::env;
7+
#[allow(unused_imports)]
68
use std::path::PathBuf;
79

810
#[test]

e2etests/tests/mcp/test_mcp_command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn test_mcp_help_command() -> Result<(), Box<dyn std::error::Error>> {
2121

2222
// Verify Usage section
2323
assert!(response.contains("Usage"), "Missing Usage section");
24-
assert!(response.contains("/mcp"), "Missing /mcp command in usage section");;
24+
assert!(response.contains("/mcp"), "Missing /mcp command in usage section");
2525

2626
// Verify Options section
2727
assert!(response.contains("Options"), "Missing Options section");

e2etests/tests/tools/test_tools_command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ fn test_shell_tool() -> Result<(), Box<dyn std::error::Error>> {
564564
println!("✅ Kiro CLI chat session started");
565565

566566
// Test shell tool by asking to run pwd command
567-
let mut response = chat.execute_command_with_timeout("Run pwd",Some(3000))?;
567+
let response = chat.execute_command_with_timeout("Run pwd",Some(3000))?;
568568

569569
println!("📝 shell response: {} bytes", response.len());
570570
println!("📝 FULL OUTPUT:");

0 commit comments

Comments
 (0)